BookmarkSubscribeRSS Feed
lisa2002
Fluorite | Level 6

Hello everyone, 

 

I have data that I need to transpose.  This is what some of the data looks like...

 

Month: April 2019   1   1   1   2   2   2

Number of Patients seen on last day of month: ________  ___________ _______

Number of Patients seen on last Friday of month:   100%     100%          100%

Provider 1    1    2    4     6

 

I need this information to look like this...

 

Month       Number of Patients seen on last day of month:          Number of Patients seen on last Friday of month:    Provider

1                ___________                                                               100%                                                                             1

1                ____________                                                              100%                                                                             1

1                _____________                                                             100%                                                                           2

 

not sure how to go about this since there is no variable in the data set that uniquely identifies each observation.  I need assistance please. 

 

Thanks

 

2 REPLIES 2
ballardw
Super User

There are lots of questions about the actual content of your current data set. We would need variable names, types, and actual values as they appear in your data.

 

The best way to provide that information is to use: Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

Tom
Super User Tom
Super User

not sure how to go about this since there is no variable in the data set that uniquely identifies each observation.

 

It is not sure what your data is but it is easy to add a unique record id.

data with_id;
  rowid + 1;
  set have;
run;
proc transpose data=with_id out=want;
  by rowid;
  ....
run;

If you want to save space and time then perhaps you should make a view instead of a dataset.

data with_idv / view=with_idv;
  rowid + 1;
  set have;
run;

 

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 430 views
  • 1 like
  • 3 in conversation