| Date: | Wed, 14 Feb 2001 22:54:57 -0500 |
| Reply-To: | lgregg@cronkite.cc.uga.edu, al@cronkite.cc.uga.edu,
acm@cronkite.cc.uga.edu, punkto@cronkite.cc.uga.edu,
org@cronkite.cc.uga.edu, fix@cronkite.cc.uga.edu,
address@cronkite.cc.uga.edu, as@cronkite.cc.uga.edu,
seems@cronkite.cc.uga.edu |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Larry Gregg <lgregg@ACM.ORG> |
| Subject: | Re: Need help with data step |
| Content-Type: | text/plain; charset=us-ascii |
michelle kay wrote:
>
> Hello SAS-Lers:
>
> I currently have a SAS dataset looks like this:
>
> Acctnum Code
> 454718 1845
> 791581 B257
> 187272 7915
> 712732 B1545
>
> I would like to transform it into:
>
> Acctnum Code Init Branch
> 454718 1845 1845 NA
> 791581 B257 -999 B257
> 187272 7915 7915 NA
> 712732 B1545 -999 B1545
> 148155 . -999 NA
>
> this is my code, but it DOES NOT work.
>
> Data one;
> Set file;
> if CODE eq 'B%' then
> Branch=CODE;
> Init = -999;
> if CODE ne 'B%' then
> Init = CODE;
> Branch = 'NA';
> if CODE eq . then
> Init = -999;
> Branch = NA;
> run;
>
> Thank you for all your help.
>
> Michelle Kay
So, where does the % come from in the 'B%'? There are no
% symbols in your sample codes. Maybe you mean something like
If substr(code,1,1) = "B" then ... ?
Let us know.
Larry
|