Help using Base SAS procedures

Possible do while or do until

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 131
Accepted Solution

Possible do while or do until

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


Accepted Solutions
Solution
‎12-05-2014 12:35 PM
SAS Super FREQ
Posts: 8,743

Re: Possible do while or do until


I'd probably try PROC TRANSPOSE first.

cynthia

View solution in original post


All Replies
Solution
‎12-05-2014 12:35 PM
SAS Super FREQ
Posts: 8,743

Re: Possible do while or do until


I'd probably try PROC TRANSPOSE first.

cynthia

Frequent Contributor
Posts: 131

Re: Possible do while or do until

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

Frequent Contributor
Posts: 131

Re: Possible do while or do until

I think I figured it out, just use idlabel

Super User
Posts: 10,500

Re: Possible do while or do until

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?

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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