i have a csv file as an example below
fname lname dob servicedate 11111 44444 55555 22222
joe smith 1/1/1970 12/1/2017 5 9 100 120
mary doe 8/12/1901 07/03/2017 40 20 60 80
proc transpose data= r_test out=r_test_tp(rename =(_name_=testname2 col1=resno));
by fname lname dob servicedate;
var
11111
44444
55555
22222
I am getting an error because of my var statement. I have only used it if the columns were titles not numbers . is there a way around this?
syntax error, expecting one of the following: a name, ;, -, :,
_ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.
Generally variable names in SAS are not allowed to start with digits. Examine your data set r_test to douple check. If so then they are called "name literals" and because they violate the standard naming conventions each one needs to be enclosed in parentheses and followed with n
'11111'n for example. It is possible that you are seeing a LABEL and not the actual variable's name. Use Proc Content or your other preferred tool for examining data set description information.
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!
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.