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());
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.