| Date: | Wed, 13 Feb 2008 15:34:10 -0600 |
| Reply-To: | Yu Zhang <zhangyu05@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Yu Zhang <zhangyu05@GMAIL.COM> |
| Subject: | Re: Please help with my coding problem! |
|
| In-Reply-To: | <704f2ebe-9423-4685-b961-27a508f69368@m34g2000hsf.googlegroups.com> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
define the length for each variable.
*
data* try (drop=i);
length first second third $25.;
set test;
array a(*) _character_;
do i = *1* to dim(a);
a[i]=put(a[i], $name.);
end;
*
run*;
On Feb 13, 2008 3:21 PM, Xuhong <zhuxuhong2000@gmail.com> wrote:
> Dear folks,
>
> Please help me resolve the coding problems as showed below.
> (I simplify my coding problems into a example as showed below. The
> problem here is the final results only show the default 8 digits. I
> also couldn't use "input" since the dataset I am using is already in
> SAS format and the dataset has more than 100 character variables and
> thousands of observations.
> So, please help me to resolve the variable length problem at the array
> part! Thanks very much!
>
> proc format;
> value $name
> "A"="assistant professor"
> "B"="associate professor"
> "C"="stuff";
> run;
>
> data test;
> input first $ second $ third $;
> datalines;
> A B C
> B B A
> C A B
> ;
>
> data try (drop=i);
> set test;
> array a(*) _character_;
> do i = 1 to dim(a);
> a[i]=put(a[i], $name.);
> end;
> run;
>
|