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());
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.