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.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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