BookmarkSubscribeRSS Feed
myboys2
Fluorite | Level 6

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_.

 

2 REPLIES 2
Reeza
Super User
It helps if you post the full log. SAS underlines the section in the code which makes it easy to find.
You can try removing the RENAME statement to see if that helps, but it looks fine to me.
ballardw
Super User

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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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