Date: Tue, 6 Dec 2005 19:02:52 +0000
Reply-To: iw1junk@COMCAST.NET
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian Whitlock <iw1junk@COMCAST.NET>
Subject: Re: output from the proc fomat
Jamil,
The use of list PUT with formats assigned (e.g. q37-q45 $q2f.)
puts a space after the value.
Perhaps you meant to write
data two ;
set collapse;
format q1 q3-q6 $q1f. q2 q37-q45 $q2f. q7-q17 $q7f. q18-q28
$q18f.
q29 $q29f. q36 $q36f. ;
FILE "c:\junk\test.dat";
put @1 q1 $q1f. q2 $q2f. (q3-q6) ($q1f.)
(q7-q17) ($q7f.) (q18-q28) ($q18f.) q29 $q29f.
(q30-q35) ($char1.) q36 $q36f. (q37-q45) ($q2f.)
;
RUN;
Ian Whitlock
===============
Date: Tue, 6 Dec 2005 11:40:02 -0600
Reply-To: Jamil Ibrahim <jibrahim@ACADAFF.UMSMED.EDU>
Sender: "SAS(r) Discussion"
From: Jamil Ibrahim <jibrahim@ACADAFF.UMSMED.EDU>
Subject: output from the proc fomat
Content-Type: text/plain; charset=US-ASCII
Hi sas users :
Why does the format adds a space between vars in the put
statement as shown below
and how to suppress the extra colmns:
options nodate nonumber ; dm 'log;clear;out;clear';
DATA collapse; input @1 (q1-q45) ($char1.) ;
cards;
53555531322211122323232244222bbbbbb1232232333
55432 3 2 11223434 4 144 1132232244
44443 3 3 23 3 2 23 1233332143
4354443 3321 1 223 3324 4 222 1 11 1333232244
;
run;
proc format;
value $q1f "1","2","3"="1" "4","5"="2";
value $q2f "1","2"="1" "3",4="2";
value $q7f "1","2"="1" "3"="2";
value $q18f "1","4"="1" "2","3"="2";
value $q29f "4","5","6","7"="4";
value $q36f "2","3","4","5","6","7"="2";
data two ;set collapse;
format q1 q3-q6 $q1f. q2 q37-q45 $q2f. q7-q17 $q7f. q18-q28
$q18f.
q29 $q29f. q36 $q36f. ;
FILE "c:\test.dat";
put @1 q1 $q1f. q2 $q2f. q3-q6 $q1f. q7-q17 $q7f.
q18-q28 $q18f. q29 $q29f.
q30-q35 $char1. q36 $q36f. q37-q45 $q2f. ;
RUN; QUIT;
the file c:\test.dat) looks like this:
222 2 2 22 1 2 1 1 1 1 1 1 1 12 2 2 2 2 2 2 1 1 2 22b b b b b b11
2 1 1 2 1 2 2 2
252 1 1 2 1 1 1 1 12 1 2 1 1 1 1 1 1 121
1 2 1 1 2 2
222 2 1 2 2 1 2 2 2 2 2 1 222
2 2 1 1 2 2
222 2 2 22 2 2 1 1 1 1 12 2 2 2 1 1 2 22 1 1 1 12
2 2 1 2 1 1 2 2
212 2 2 21 1 2 1 1 1 1 1 1 1 12 1 2 2 1 1 1 1 1 2 12 11
2 1 2 1 2 1 2 2
222 2 2 22 2 2 1 1 1 1 12 2 2 2 1 1 1 12 12
2 2 1 2 1 1 2 2
211 1 1 2 2 1 1 1 1 1 1 1 1 12
2 1 2 2 1 1 2 2
222 2 2 22 2 1 2 1 1 1 12 1 2 2 2 2 1 1 1 2 23 11
2 2 2 2 2 1 2 1
Dr. Jamil Ibrahim, Ph.D.
Institutional Research Associate
Assistant Professor , SHRP
Univ. Of Miss. Med. CTR.
2500 N state St
Jackson, MS 39216
Tel. 601-984-1197
Fax 601-984-1205
Nternet: jibrahim@acadaff.umsmed.edu
The information contained in the attachment(s) to this email is
confidential. If you were not expecting a confidential
|