BookmarkSubscribeRSS Feed
Aman4SAS
Obsidian | Level 7

Dear friends looking for your help.

Kindly suggest:

Description

Pattern: A103,A104,A105,A106 belong to same person;

i need output data in form of

ID                                year month value_of_A103 value_of_A104 value_of_A105   value_of_A106

A103|A104|A105|A106  1976 M01    9.4                  596104           5739058           6335162

there thousands of id in same pattern. kindly suggest

please find attached sample file.

1 REPLY 1
PGStats
Opal | Level 21

Does this make sense to you?

data banktest;
infile "&sasforum.\datasets\banktest.txt" firstobs=2 dlm='09'x;
input ID $ year Month $ value;
run;

proc sort data=banktest; by year month id; run;

data banktemp;
length newId $64;
do until(last.month);
     set banktest; by year month id;
     if last.id then newId = catx("|", newId, Id);
     end;
do until(last.month);
     set banktest; by year month;
     output;
     end;
run;

proc transpose data=banktemp prefix=value_of_
     out=bankWant(drop=_name_);
by year month newId notsorted;
id id;

var value;
run;

proc print data=bankWant noobs; run;

PG

PG

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 623 views
  • 0 likes
  • 2 in conversation