BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Q1983
Lapis Lazuli | Level 10

Newbie to sas with a question

data borrower (keep=ln_no id_no);

set table1;

run;

sample data

ln_no         id_no

1111          00000

1112          00000

1113          00002

1114          00006

1115          99999

1116          99999

I want to be able to show the data like this

id_no           first_ln_no      second_ln_no

00000           11111            11112

00002           11113

00006            11114

99999            11115            11116

There can be up to 5 scenarios where one id_no could have several ln_no.  Would  I need some type of do until statement

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ


I'd probably try PROC TRANSPOSE first.

cynthia

View solution in original post

4 REPLIES 4
Cynthia_sas
SAS Super FREQ


I'd probably try PROC TRANSPOSE first.

cynthia

Q1983
Lapis Lazuli | Level 10

Your solution worked lik a charm.  Here is a sample code and output

proc transpose data=borrower out=borrower2

(drop = _NAME_ _LABEL_) ;

id ln_no

by id_no;

var ln_no;

run;

sample output

id_no                 11111      11112

00000                11111      11112

Is there a way to assign label to the value as a header.  What happens is I get the actual data as both a header and in the detail

Q1983
Lapis Lazuli | Level 10

I think I figured it out, just use idlabel

ballardw
Super User

Just for clarification: You sample data shows ln_no with 4 characters but the desired output the variable has 5. Is that by chance an error in pasting the sample data?

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