BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sapkota
Calcite | Level 5

I have hundreds of value in the following format in one SAS dataset:

ID                  Chemical     Value

AS4001X    abc               1.4

AS4001X   def                3.2

AS4001X    ghi                3.4

BC4002Y    abc               2.1

BC4002Y    def                4.3

BC4002Y    ghi               5.4

..................

and so on

I would like is to change each value of 'Chemical' into a variable so that I get the new dataset that look like this:

ID                abc         def         ghi

AS4001X    1.4           3.2       3.4

BC4002Y    2.1           4.3       5.4

...........

Please suggest how do I go about about making such modification of dataset. I thank you all in advance.

Sapkota

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Typical task for Proc Transpose:

proc transpose data=have out=want(drop=_name_);

by ID;

var Value;

id Chemical;

run;

PG

PG

View solution in original post

2 REPLIES 2
Reeza
Super User

Look into Proc Transpose

PGStats
Opal | Level 21

Typical task for Proc Transpose:

proc transpose data=have out=want(drop=_name_);

by ID;

var Value;

id Chemical;

run;

PG

PG

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 2 replies
  • 406 views
  • 5 likes
  • 3 in conversation