BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mauri0623
Quartz | Level 8

 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 &timestamp; &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.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.

View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

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.

PaigeMiller
Diamond | Level 26

@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());

 

--
Paige Miller
mauri0623
Quartz | Level 8
I was not asking for timestamp. I was asking about how to create raw_pips as a macro variable.

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 376 views
  • 0 likes
  • 3 in conversation