Date: Thu, 23 Dec 2004 09:41:07 -0800
Reply-To: David Fickbohm <DavidF@HOMEGAIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David Fickbohm <DavidF@HOMEGAIN.COM>
Subject: Losing data when writing a text file out
Content-Type: text/plain; charset="iso-8859-1"
People,
I am trying to write out a text file. The text file will be read into an
excel spreadsheet. I am using "|" between each variable. I am having two
problems.
1 - The first line of data currently does not get written out (I think I
need to extend or add another put statement below the first put and have
tried all kinds of combinations and have gotten nowhere but frustrated.)
2 - Each line starts off with a "|". Excel treats this as a blank variable
and when the text file is written to excel the first column shows in column
B.
Here is the current code:
DATA _NULL_;
SET FINAL04;
file "T:\DM\~\USERS\DAVEF\AGENT_LEADS\OUTPUT\LEADS3_122304.TXT" noprint
notitles;
IF _N_ = 1 THEN
PUT
'userid|email|lead1type|lead1city|lead2type|lead2city|lead3type|lead3city|us
ername
|zips8|dailyleads|lead1est|lead2est|lead3est|first name';
ELSE
PUT (USERID EMAIL LEAD1TYPE LEAD1CITY LEAD2TYPE LEAD2CITY LEAD3TYPE
LEAD3CITY USERNAME
ZIPS8 DAILYLEADS LEAD1EST LEAD2EST LEAD3EST FIRSTNAME)(+1'|');
RUN;
Here is some sample data
userid email lead1type lead1city
lead2type lead2city lead3type lead3city username zips8 dailyleads lead1est
lead2est lead3est firstname
1111 df@11.net buyer sf seller
sa buyer sr abc yes 3
12345 12345 12345 dave
5556 lexington_office@hunneman.com Buyer Waltham . . .
. marcia stille off 3 $600,000 $500,000 Marcia
5564 marykay1@mindspring.com Buyer Durham . . . . .marykay
pendergraph .on .1 .$175,000 . . Mary Kay
Here is the current output
userid|email|lead1type|lead1city|lead2type|lead2city|lead3type|lead3city|use
rname |zips8|dailyleads|lead1est|lead2est|lead3est|first name
|5556 |lexington_office@hunneman.com |Buyer |Waltham | | | |
|marcia stille |off |1 |$600,000 |. |. |Marcia
|5564 |marykay1@mindspring.com |Buyer |Durham | | | | |marykay
pendergraph |on |1 |$175,000 |. |. |Mary Kay
I need
userid|email|lead1type|lead1city|lead2type|lead2city|lead3type|lead3city|use
rname |zips8|dailyleads|lead1est|lead2est|lead3est|first name
1111 |abc@yahoo.com|buyer|somewhere|seller|another|seller|thirdcity|joe
blow|yes|3|12345|12345|12345|dave
5556 |lexington_office@hunneman.com |Buyer |Waltham | | | |
|marcia stille |off |1 |$600,000 |. |. |Marcia
5564 |marykay1@mindspring.com |Buyer |Durham | | | | |marykay
pendergraph |on |1 |$175,000 |. |. |Mary Kay
All help, thoughts, ideas, greatly appreciated.
Thanks
Dave