BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
dcortell
Pyrite | Level 9

 In the below code I get as error the one declared in the title. Due to the fact that the option validvarname=any is used, I would expect that the space in the variable should not cause an error in the proc freq ouput. Please, share what I'm missing

%do j=1 %to &nclass;

options validvarname=any;

proc freq data=&train noprint;
tables &var / out="_&var2.&j"n (drop=count) missing;
where &target=&j;
run;

%end j;


MPRINT(NB): proc freq data=move.language_det_train noprint;
SYMBOLGEN: Macro variable VAR resolves to "rank_ a"n SYMBOLGEN: Macro variable VAR2 resolves to rank_ a
SYMBOLGEN: Macro variable J resolves to 1
ERROR: The value '_RANK_ A1'n is not a valid SAS na 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Why do you want a blank in a dataset name? Just remove it from &var2, and you can also remove the ".."n for the dataset name. It will REALLY make your future work easier.

 

If you insist on making your life miserable, use

options validmemname=extend;

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

Why do you want a blank in a dataset name? Just remove it from &var2, and you can also remove the ".."n for the dataset name. It will REALLY make your future work easier.

 

If you insist on making your life miserable, use

options validmemname=extend;
Reeza
Super User
Check what the variable name actually is in PROC CONTENTS and use that?
Or use the EXTEND option as indicated by @Kurt_Bremser.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 2 replies
  • 1058 views
  • 3 likes
  • 3 in conversation