Dear All:
I want to output a .txt data set such that there is one column space
between each variable fields. Here is my code below:
data au;
file 'c:\putoutput.txt';
retain id sex ageyrs htcm;
set nomiss(keep=id sex ageyrs htcm);
put @1 ID z3.
@4 sex 1.
@6 ageyrs z5.2
@11 htcm z7.3; run;
And here is the output I am getting:
0011 06.86 123.300
0011 07.29 124.900
0022 00.19 052.200
Question:
Does anybody know how to format this so that I get exactly one column
space between the vars?
like this 001 1 06.86 123.300 ?
Currently the ID and sex fields are together. My tweaking has not
helped much either.
Thanks in advance.
Yaw
|
|
0
|
|
|
|
Reply
|
Yaw
|
3/18/2010 3:20:27 AM |
|
On Mar 17, 11:20=A0pm, Yaw <link...@gmail.com> wrote:
> Dear All:
>
> I want to output a .txt data set such that there is one column space
> between each variable fields. Here is my code below:
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0data au;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 file 'c:\putoutput.txt';
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 retain id sex ageyrs htcm=
;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 set nomiss(keep=3Did sex =
ageyrs htcm);
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 put =A0 @1 ID z3.
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 @4 sex 1.
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 @6 ageyrs=
z5.2
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 @11 htcm =
z7.3; run;
>
> And here is the output I am getting:
>
> 0011 06.86 123.300
> 0011 07.29 124.900
> 0022 00.19 052.200
>
> Question:
> Does anybody know how to format this so that I get exactly one column
> space between the vars?
>
> like this 001 1 06.86 123.300 ?
>
> Currently the ID and sex fields are together. My tweaking has not
> helped much either.
>
> Thanks in advance.
>
> Yaw
You should bump up 4,6 & 12 to 5,7&13
--
Richard
|
|
0
|
|
|
|
Reply
|
Richard
|
3/18/2010 4:43:08 AM
|
|
May be something like in this example (using +1):
data _null_;
input nv1 cv1 $ nv2 cv2 $;
put @1 nv1 z8. +1 cv1 nv2 date9. +1 cv2;
datalines;
23456 abc 12 x
23 abcdefg 12 x
2 abc 12345 x
;
run;
|
|
0
|
|
|
|
Reply
|
Patrick
|
3/18/2010 9:17:20 AM
|
|