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. 

 

 

 

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
  • 18 replies
  • 3673 views
  • 4 likes
  • 5 in conversation