BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pp2014
Fluorite | Level 6

I am trying to transpose the questions/answers for each ID.

  But some how the values of ID Variable question gets truncated.  How it can be fixed?

Any help will be highly appreciated.

Below is my sas code:

data have;

  infile datalines missover; 

    input id $2. quest $43. ans  $20.; 

    datalines;

12 HAVE YOU TAKEN THE DOSE IN LAST 2 MONTHS?   NO

12 WHICH MEDICATION YOU ARE ON?                          XYZ

;

proc sort data=have;     

by id ;

run;

proc transpose data=have                out=want (drop=_name_ );

id quest;

var ans;

by id;

run;

Above Transpose procedure truncates values of quest variable.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

SAS variables have a limit of 32 characters for the name. I would highly recommend a different name ie quest1, quest2 and use IDLABEL to apply quest as the label.

View solution in original post

3 REPLIES 3
Reeza
Super User

SAS variables have a limit of 32 characters for the name. I would highly recommend a different name ie quest1, quest2 and use IDLABEL to apply quest as the label.

pp2014
Fluorite | Level 6

Thanks Reeza.  I used IDLABEL. It worked...

Steelers_In_DC
Barite | Level 11

SAS names can be 32 characters long.  That's where this is being truncated.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 1120 views
  • 0 likes
  • 3 in conversation