I have a program that use proc transpose and uses a numeric variable (value 0.12, 1, 2) as the id var. Proc transpose runs without errors, but when the next proc or datadtep use the var name, it gives error e.g. 0_12 does not exists.
Same code runs without issues from SAS 9.4
Is this a known issue with enterprise guide?
Look like you are using SAS/EG , and EG use options validvarname=any; by default ,
therefore change it as options validvarname=v7;
Xia Keshan
Post some example data and the code used or generated.
And 0_12 is not a valid SAS variable name normally so, it isn't surprising that it doesn't exist.
Hi,
Thanks for response. Below is the sample code and warning. Same code works fine in SAS 9.4
data test;
input id $ x aval;
datalines;
1001-101 0.35 1
1002-103 1 2
1002-104 3 1
1003-105 5 2
;
proc transpose data=test out=test1 prefix=x;
by id;
var aval;
id x;
run;
data test2(keep=id x0_35);
set test1;
run;
WARNING: The variable x0_35 in the DROP, KEEP, or RENAME list has never been referenced.
Look like you are using SAS/EG , and EG use options validvarname=any; by default ,
therefore change it as options validvarname=v7;
Xia Keshan
Could you run Proc Contents on dataset test. We need to know what variable name SAS DID assign to that transposed variable.
Is it possible that it did not include the 0?
proc contents data=test1 varnum ; * I like to use the varnum option to preserve the variable order ;
Maybe you could control the naming convention by creating a character variable as part of your "test" dataset and then use THAT as your id variable? like:
data test;
input id $ x aval;
length x_char $4 ;
if x < 1 then x_char = put(x, z4.2) ; /* using zero-filled format */
else x_char = trim(left(x));
datalines;
1001-101 0.35 1
1002-103 1 2
1002-104 3 1
1003-105 5 2
;
run ;
proc print data=test ;
run ;
proc transpose data=test out=test1 prefix=x;
by id;
var aval;
id x_char;
run;
proc contents data=test1 varnum;
run ;
Ah, looks like xia keshan has the correct answer!
Yes, options validvarname=v7 worked. Thank you all and specially xia keshan.
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.
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.