BookmarkSubscribeRSS Feed
Ani_Abby
Obsidian | Level 7

Hi. I have this piece of coding whereby I use Load_Dt which add using Prompt Manager with following info:

     Prompt type:                                     Date
     Method for populating prompt:             User enters value

     Number of values :                              Sing value

     Date type :                                        Day

     Options (which I choose) :               1) Requires a non-blank value               2) Use prompt value throughout project

%put &Load_Dt;

data _null_;
     initialdt = &Load_Dt.;

     call symput('initialdt',initialdt);
     call symput('initialdt_',initialdt_);
     call symput('DDMMYY',put(initialdt,DDMMYYN6.));
     call symput('YYYYMM',put(initialdt,YYMMN6.));
     call symput('YYYYQQ',put(initialdt,YYQ6.));
run;

%put &initialdt.;
%put &initialdt_.;
%put &DDMMYY.;
%put &YYYYMM.;
%put &YYYYQQ.;

Here is the log I got after running the program.

19         %put &Load_Dt;
31Aug2012
20         


21         data _null_;
22              initialdt = &Load_Dt.;
NOTE: Line generated by the macro variable "LOAD_DT".
22          31Aug2012
              _______
              22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, , =, >, >=, AND, EQ, GE, GT, IN, 
              LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.  
23
34              call symput('initialdt',initialdt);
25              call symput('initialdt_',initialdt_);
26              call symput('DDMMYY',put(initialdt,DDMMYYN6.));
27              call symput('YYYYMM',put(initialdt,YYMMN6.));
28              call symput('YYYYQQ',put(initialdt,YYQ6.));
29         run;

30         
31         %put &initialdt.;
put(31Aug2012,DDMMYY10.)
32         %put &initialdt_.;
.
33         %put &DDMMYY.;
.
34         %put &YYYYMM.;
.
35         %put &YYYYQQ.;
.

I don't which code goes wrong, is it date, macro or prompt. I really need big help on this. Usually I pre-code the date in as initialdt = '31AUG2012'd  which work perfectly but the user wants to choose their own date. Having the dataset that I need to choose name ended with &YYYYMM is not helping with the prompt.

Thank you so much.

1 REPLY 1
shivas
Pyrite | Level 9

Hi,

initialdt = &Load_Dt.;

change this to and try...

initialdt = "&Load_Dt"d;

Thanks,

Shiva

SAS Innovate 2025: Call for Content

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!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 2526 views
  • 0 likes
  • 2 in conversation