BookmarkSubscribeRSS Feed
MCB2
Calcite | Level 5

Hi,

 

My data consists of individuals (ID) who can appear several times with the same Date (Datex) but in different years.
The Year variable is unique within its ID and Datex. In my example, ID=1 has two different Datex that appear 4 times each.
The variable Year as unique values ​​in each Block of variable Datex  (see the table below). What I need to do is reformat the "Mark_type"
from long to wide for each ID within the DATEx
Tanks!

IDDatexYearMark_type
12005-05-0520082
12005-05-0520101
12005-05-0520111
12005-05-0520161
12012-02-0220132
12012-02-0220151
12012-02-0220161
12012-02-0220181
22010-05-1620113
22011-07-0520113
4 REPLIES 4
PaigeMiller
Diamond | Level 26

Why re-format at all? What can you do with a wide format that you can't do with a long format?

--
Paige Miller
MCB2
Calcite | Level 5
I need later on to concatinate the variable I am reshaping.
PaigeMiller
Diamond | Level 26

 


@MCB2 wrote:
I need later on to concatinate the variable I am reshaping.


This doesn't really explain why you need it. This doesn't really explain how having a wide data set lets you do things that you can't do with a long data set. What are you going to do (what analysis, what report) with this concatenated variable(s) once you have them?

--
Paige Miller
Reeza
Super User
Show expected output please.

Are you trying to concatenate a text field into a single value?
https://gist.github.com/statgeek/d583cfa992bf56da51d435165b07e96a

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

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