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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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