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
Diamond | Level 26


I'd probably try PROC TRANSPOSE first.

cynthia

View solution in original post

4 REPLIES 4
Cynthia_sas
Diamond | Level 26


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?

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2871 views
  • 0 likes
  • 3 in conversation