Help using Base SAS procedures

Help with PROC Transpose

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 124
Accepted Solution

Help with PROC Transpose

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.


Accepted Solutions
Solution
‎06-03-2015 01:24 PM
Super User
Posts: 17,750

Re: Help with PROC Transpose

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


All Replies
Solution
‎06-03-2015 01:24 PM
Super User
Posts: 17,750

Re: Help with PROC Transpose

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.

Frequent Contributor
Posts: 124

Re: Help with PROC Transpose

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

Valued Guide
Posts: 858

Re: Help with PROC Transpose

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 278 views
  • 0 likes
  • 3 in conversation