BookmarkSubscribeRSS Feed
EllaXu
Calcite | Level 5

Hi, there, 

 Can anyone please show me how to transpose data with missing ID /CODE? Please see the sample enclosed.

See the screenshot below:

EllaXu_0-1594900442723.png

C:\Users\22296171\Desktop 

4 REPLIES 4
Jagadishkatam
Amethyst | Level 16
We cannot transpose the missing values
Thanks,
Jag
EllaXu
Calcite | Level 5
Sorry I didn't describe the issue clearly. The variables are not lined up properly in the right columns(see the highlighted in yellow cells), due to the missing id/code, so the question is how can I fix the missing code or ID?
andreas_lds
Jade | Level 19

I can't open excel-files, so could you please post the data as data-step using datalines-statement? See https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/ for details.

Kurt_Bremser
Super User

Please post your dataset in a usable way (data step with datalines), and the code you used for the transpose.

 

I cleaned up your Excel file, and ran this:

proc import
  datafile="/folders/myfolders/transpose1.xlsx"
  out=transpose1
  dbms=xlsx
  replace
;
run;

proc transpose data=transpose1 out=trans;
var year:;
by code notsorted;
id datatype;
run;

which worked for me.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 863 views
  • 0 likes
  • 4 in conversation