- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
so i created a table as such...
data _null1_; options mprint symbolgen mlogic; td00=today(); td01=intnx('month',today(),-7); td02=intnx('month',today(),-8); td03=intnx('month',today(),-9); mnth=month(td01); nm_mnth=put(td01,monname3.); lmnth=month(td02); nm_lmnth=put(td02,monname3.); call symput('mth02',month(td01)); call symput('mth03',month(td02)); call symput('qtryr',QTRYR); call symput('worddate',todaya); call symput('numdate',todayb); call symput('l0numshortdate',ytrd00); call symput('l1numshortdate',ytrd01); call symput('l2numshortdate',ytrd02); call symput('l3numshortdate',ytrd03); run;
and now i want to use some of those date calculations in all sorts of crazy and fantastic ways but i keep getting errors in some instances. how can i pass, say mnth or lm_mnth into a macro-variable for use that way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You need to show how you are using the macro variables to understand whether how you are creating them is proper.
First thing to fix however is to stop using the older CALL SYMPUT() and use the newer CALL SYMPUTX(). That will at least remove the leading spaces caused by SAS having to convert the numeric values you are passing as the second argument. CALL SYMPUT() wants a character string there so SAS did a default numeric to character conversion which will use the BEST12. format.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@me55 wrote:
... but i keep getting errors in some instances. how can i pass, say mnth or lm_mnth into a macro-variable for use that way.
I really don't understand what you mean, or what errors you are getting. Also, CALL SYMPUT does create macro variables, but you are implying that it does not. Please explain further. Please provide details about the errors (show the code and ERRORs in the LOG).
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
All the data step variables used in these statements
call symput('qtryr',QTRYR);
call symput('worddate',todaya);
call symput('numdate',todayb);
call symput('l0numshortdate',ytrd00);
call symput('l1numshortdate',ytrd01);
call symput('l2numshortdate',ytrd02);
call symput('l3numshortdate',ytrd03);
have not been created, so SAS creates them for you and initializes them to missing, which is what you get in the macro variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Where is your set statement? Also get rid of the 1 at the end of _null_.
You need to do this:
data _null_;
set /*input dataset goes here*/;
*create your variables;
*use call symputx;
run;