SAS data step view and data wrap in a macro for loop

后端 未结 3 1464
挽巷
挽巷 2021-01-28 00:30

For a university research project I am retrieving data from WRDS via SAS and am relatively new to SAS. I am trying to retrieve data in a specific interval provided by WRDS which

3条回答
  •  难免孤独
    2021-01-28 01:09

    I am using SAS Studio working on the WRDS cloud. I have realized the following:

    When I run my code - not as a macro - "block_by-block", then everything works very fine. If I run the entire script, I get an error in the data xtemp2 part:

     73          '9:30:00't and '16:00:00't) and     mode = 12 and            EX =
     73       ! 'N';           run;   *Screen data to find the trade before a set
     73       ! time interval   data xtemp2;       set _v_&tables;       by symbol
                                                   ___
                                                   180
     73       ! date time;       format itime rtime time12.;       if
     ERROR 180-322: Statement is not valid or it is used out of proper order.
    

    But if I run my code once block-by-block, afterwards I can run the entire script without any issues.

    So I think the solution is to run the code blocks sequentially. Is there a possibility to "simulate" a sequential run within the code?

    edit: I tried to use the sleep function to pause the code there but that still doesn't work, it gives me the error:

     129        data xtemp2;
     130             set _v_&tables;
     130             set _v_&tables;
                     ___
                     180
     ERROR 180-322: Statement is not valid or it is used out of proper order.
     .
     .
     .
    

    v&tables comes from my data step view.

    edit: I tried the sleep function, however, it doesnt work. Funnily, if I run everything until data step view and then run everything from the actual data step the code words; and after that I can re-run the FULL code instead of splitting by two times.

    I will create a new question which links back to this and the above mentioned question where I wrap the code into a macro...

    SOLUTION FOUND: I had to add extra "run;" statements before the data steps and then it works (credits to Richard who found this).

提交回复
热议问题