BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

To keep more variables in the output of PROC TRANSPOSE you can either add them to the BY statement.

Or use the COPY statement.

ballardw
Super User

@Mscarboncopy wrote:

Thank you. If I have to write this for each string in my data files, I won't be able to do it this way, as I have hundreds of them. Unless, I am misunderstanding.

longvar = "I need; to create; 3 short variables"; output;
longvar="Must; create; three short variables"; output;
run;

 


This sort of code, like the example data set I provided, are just to have something to code with. Your data set should already have your varaible with the text in it.

Mscarboncopy
Pyrite | Level 9

Thank you. It was an oversight on my part. The code worked really well. The only thing I need to do now is to use another ID variable in this code (If I use my main ID variables it becomes obs). Thankfully I have 2 ID vars, one that is a string (and I do not need to keep) and the other one is numeric and must keep. I want to use the Id var that is a string in this code. However I am getting  " Numeric values have been converted to character values". The N is unchanged and the dat is all  there. I tried to transform the string into numeric but my string var for the ids have different widths. Can I ignore the warning? Or should I work on finding a way to convert this string into numeric?  Also, how do I make sure that the main ID variable (my numeric one in this case) is showing up in the final Wide data file? Right now, I don't have a subject ID var and I really need that. It only has the obs and the split up string. 

 

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 18 replies
  • 1482 views
  • 4 likes
  • 5 in conversation