BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. 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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2305 views
  • 3 likes
  • 3 in conversation