I am trying to create a macro variable called raw_pips. When I do it does not getting resolved.
30 data _null_;
31 call symputx('timestamp', put(datetime(), B8601DT.));
32 %let raw_pips = PipsDaily_0123_0100.txt;
33 run;
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
34 %put ×tamp; &raw_pips;
20200123T091816
NOTE: Line generated by the macro variable "RAW_PIPS".
1 PipsDaily_0123_0100.txt
-----------------------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
You have an extra semi-colon that is ending the %put statement.
Also you are confusing yourself by inserting a %let in the middle of a data step. Move line 32 out of the data step.
You have an extra semi-colon that is ending the %put statement.
Also you are confusing yourself by inserting a %let in the middle of a data step. Move line 32 out of the data step.
@mauri0623 wrote:
31 call symputx('timestamp', put(datetime(), B8601DT.));
It is very rare that you need macro variables for calendar or date/time to be formatted, and usually this is a mistake. If you are going to use the macro variable for some comparison to some other date/time value or a calculation to determine a time/day duration from some other date, formatting does not help and usually produces incorrect results. Leave macro variables for calendar dates or date/time values unformatted, except in the case where you want to use them in a title or label.
call symputx('timestamp', datetime());
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: