BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SASuserlot
Barite | Level 11

I want to transpose the data and how I have and want. Is it possible? dates/time are in datetime16. format in have datasets. I really appreciate any help you can provide.

SASuserlot_0-1707933608354.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

From now on, even in this small example, would you please provide data not as screen captures but as text in the form of working SAS data step code? (examples and instructions) Thank you. We cannot work with data in a screen capture.

 

Here is the idea that ought to get what you want on your data. I use a different data set because I cannot work with data in a screen capture.

 

proc transpose data=sashelp.class(obs=1) out=want prefix=all;
    by name;
    var height weight age;
run;

 

 

Adding: it makes sense (to me) to have dates in a column. It does not make sense (to me) to also have the value of COUNT in the same column as date, and so I would suggest you re-think the layout that your want.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

From now on, even in this small example, would you please provide data not as screen captures but as text in the form of working SAS data step code? (examples and instructions) Thank you. We cannot work with data in a screen capture.

 

Here is the idea that ought to get what you want on your data. I use a different data set because I cannot work with data in a screen capture.

 

proc transpose data=sashelp.class(obs=1) out=want prefix=all;
    by name;
    var height weight age;
run;

 

 

Adding: it makes sense (to me) to have dates in a column. It does not make sense (to me) to also have the value of COUNT in the same column as date, and so I would suggest you re-think the layout that your want.

--
Paige Miller
SASuserlot
Barite | Level 11

@PaigeMiller  My apologies; my sample code has not shown up here for some reason. Maybe I did not paste it correctly and just submitted a query. I realized that with your responses. Thanks for helping out. I resolved the issue, Just doing two transposes, one for 'dates' and one for 'count'', then appended.

Thanks.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 2 replies
  • 565 views
  • 1 like
  • 2 in conversation