Date: Fri, 26 Aug 2005 09:47:35 -0400
Reply-To: Peter Crawford <peter1.crawford@CITIGROUP.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Peter Crawford <peter1.crawford@CITIGROUP.COM>
Subject: Re: Lots of info in columns,
how to transfer those to separate lines?
FYI: V6.12; only Base-sas available...
!!! not a wise choice!
However, it can work, if the platform is licensed validly !
* this prog creates two tables.
Head per barcode,
and Detail, per outlet-with-sales within barcode
filename whatevr '<path and name of input file>' lrecl= 10000 ;
data head( keep= barcode desc price Etc1 etc2 etc3 outlets )
detail(keep= barcode outletID out_sales ) ;
length barcode $25 desc $40 price 8 etc1-etc3 $20
OutletID out_sales 8 ;
infile whatevr dsd dlm=';' truncover ;
input barcode desc price Etc1 etc2 etc3 @;
outlets = 0;
do outletID = 1 to 256 ;
input out_sales @;
if not out_sales then continue ;
output detail ;
outlets = outlets +1 ;
output head ;
well, something like that...............
I know it can work, because I cut my sas teeth on something like
this (a few years ago ++ )
On Fri, 26 Aug 2005 05:43:54 -0700, mkiewiet@GFKBLX.NL wrote:
>I have bit of a strange problem. I need to process a file from an
>external source and convert it to a better accessible format.
>The file contains sales info of items from a shop with >250 outlets.
>It's a semi-colon separated file, the first 6 fields contain info like
>description, barcode and price of the item and then there are 256
>consequential columns, each containing the sales per outlet.
>What I want to do now is for each barcode creating a line with the
>sales per outlet. So instead if one line with all sales, I now want to
>have (max.) 256 lines per item with ony the sales of one outlet. And
>that has to be repeated for all barcodes in the original file.
>For me, the only way to do this would be to create 256 different
>tables, and then make sure that in each table only the sales of one
>outlet remain. Then put all those tables back into one table again and
>then I have what I want.
>But, this is a huge amount of work and not very efficient.
>As you may understand from this story: I'm not an advanced
>sas-programmer. So I hope that between you guys maybe someone who is
>willing to help me out in doing this in an easier way....
>I need to run the program every day, so any improvement in efficiency
>will be highly appreciated
>FYI: V6.12; only Base-sas available...
>Thanks a lot for any information which may lead to improve the way to