f



Re: Reading in multiple raw data files with headers #5

Katherine,

Unfortunately, while I had just written and tested a solution that worked,
my office is currently upgrading our system and I lost access to what I
had written.  I'll do my best to recall, but no guarantees.

If it doesn't work, write me offline and I'll send you what I know had
worked when I can again access my system on Tuesday.

data allfiles;
  infile 'C:\sasdata\file*.txt' dlm='09'x eov=newfile missover;
  input x $255 @;
  retain newfile;
  if _n_ eq 1 or newfile then do;
    newfile=0;
    test+1;
  end;
  else do;
    input @1 var1 var2 var3 var4 var5;
    output;
  end;
run;

HTH,
Art
----------
On Fri, 19 May 2006 14:36:23 +1000, Katherine Smith
<katherine.smith@MCRI.EDU.AU> wrote:

>Hello all,
>
>I am trying to read in and stack multiple raw data files (file1, file2
>etc)which contain the same variables (var1, var2 etc) but refer to
>different time periods. I also want to add a variable to the final dataset
>so that I can tell which file an observation originally came from. The
>following program works fine when I try to read in text files without a
>line of variable names at the top (omitting the firstobs=2 option).
>However, I get 'invalid data' error messages when I try to read in
>tab-delimited text files with a line of variable names at the top.
>
>data allfiles;
>    infile 'C:\sasdata\file*.txt' dlm='09'x firstobs=2 eov=newfile
missover;
>    input var1 var2 var3 var4 var5;
>    retain time 1;
>    if newfile then do;
>         newfile=0;
>         time+1;
>    end;
>run;
>
>The error message refers to the first line of each of file2, file3 etc.I
>conclude that SAS only applies the firstobs=2 observation ONCE when
reading
>in and stacking multiple files. Is there any way that I can fix this
>problem apart from going through the text files and manually deleting the
>line of variable names for each file?
>
>I'm using SAS version 8.2.
>
>Many thanks,
>
>Katherine
0
art297 (4213)
5/19/2006 11:07:45 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
279 Views

Similar Articles

[PageSpeed] 42

Reply:

Similar Artilces:

Re: Reading in multiple raw data files with headers
Dear Katherine, Departing from your code I would propose the following *untested* amendment: data allfiles; infile 'C:\sasdata\file*.txt' dlm='09'x firstobs=2 eov=newfile missover; retain time 1; if newfile then do; * First record of each next, not first file; newfile=0; * Is this really necessary? Not auto-0 next record? ; time+1; INPUT; * Skip each first line of new file, no variables specified; end; ELSE input var1 var2 var3 var4 var5; * Read the variables as desired; run; Try this and tell us whether it works. Regards - Jim. -- Jim Groeneveld, Netherlands Statistician, SAS consultant home.hccnet.nl/jim.groeneveld On Fri, 19 May 2006 14:36:23 +1000, Katherine Smith <katherine.smith@MCRI.EDU.AU> wrote: >Hello all, > >I am trying to read in and stack multiple raw data files (file1, file2 >etc)which contain the same variables (var1, var2 etc) but refer to >different time periods. I also want to add a variable to the final dataset >so that I can tell which file an observation originally came from. The >following program works fine when I try to read in text files without a >line of variable names at the top (omitting the firstobs=2 option). >However, I get 'invalid data' error messages when I try to read in >tab-delimited text files with a line of variable names at the top. > >data allfiles; > infile 'C:\sasdata\file*.txt' dlm='09'x firstobs=2 eov=newfile missov...

Re: Reading in multiple raw data files with headers #6 1553905
See below for some important corrections. On Fri, 19 May 2006 07:18:32 -0400, Jim Groeneveld <jim2stat@YAHOO.CO.UK> wrote: >Dear Katherine, > >Departing from your code I would propose the following *untested* amendment: > >data allfiles; > infile 'C:\sasdata\file*.txt' dlm='09'x firstobs=2 eov=newfile missover; > retain time 1; Insert here: input @; Otherwise code will be inspecting the EOV flag for the previous record. > if newfile then do; * First record of each next, not first file; > newfile=0; * Is this really necessary? Not auto-0 next record? ; Above is necessary; not automatically reset. > time+1; > INPUT; * Skip each first line of new file, no variables specified; Change INPUT to DELETE. That will not only release the buffer but also prevent outputting an observation full of missing values. > end; > ELSE input var1 var2 var3 var4 var5; * Read the variables as desired; >run; > >Try this and tell us whether it works. > >Regards - Jim. >-- >Jim Groeneveld, Netherlands >Statistician, SAS consultant >home.hccnet.nl/jim.groeneveld > > >On Fri, 19 May 2006 14:36:23 +1000, Katherine Smith ><katherine.smith@MCRI.EDU.AU> wrote: > >>Hello all, >> >>I am trying to read in and stack multiple raw data files (file1, file2 >>etc)which contain the same variables (var1, var2 etc) but refer to >>different time periods. I a...

Re: Reading in multiple raw data files with headers #4 1553854
you can use system pipe to do so very easily. Here is code and you might need to change something. /* SAMPLE DATA IN 4 FILES WITH UNKNOWN NAMES 12011997 M 09/08/04 12011997 F 01/26/01 .... */ /* USE PIPE TO RETURN A LIST OF FILENAMES */ filename indata pipe 'dir "C:\temp" /b'; data File Data; format path $100.; /* OPEN A PIPE FOR INPUT */ infile indata truncover; /* INPUT FILE NAMES */ input file $20.; /* SPECIFY FULL PATH OF FILES */ if index(file, "yourheader") >= 1 then path = 'C:\temp\'||file; put path; /* OPEN EACH FILE */ infile dummy filevar = path end = done truncover; do while(not done); /* INPUT DATA IN THE FILE */ input Account $ 1-8 Sex $ 10-10 Date mmddyy8.; format Date Date.; output; end; run; On 5/19/06, Katherine Smith <katherine.smith@mcri.edu.au> wrote: > Hello all, > > I am trying to read in and stack multiple raw data files (file1, file2 > etc)which contain the same variables (var1, var2 etc) but refer to > different time periods. I also want to add a variable to the final dataset > so that I can tell which file an observation originally came from. The > following program works fine when I try to read in text files without a > line of variable names at the top (omitting the firstobs=2 option). > However, I get 'invalid data' error messages when I try to read in > tab-delimited text files with a line of variable names at the top. > > data allfiles; > infile...

Reading in multiple raw data files with headers
Hello all, I am trying to read in and stack multiple raw data files (file1, file2 etc)which contain the same variables (var1, var2 etc) but refer to different time periods. I also want to add a variable to the final dataset so that I can tell which file an observation originally came from. The following program works fine when I try to read in text files without a line of variable names at the top (omitting the firstobs=2 option). However, I get 'invalid data' error messages when I try to read in tab-delimited text files with a line of variable names at the top. data allfiles; in...

Re: Reading Multiple Raw Files ..
Kumar Here's a bit of code which reads a series of files and writes them out appending the filename. data a; filename txt 'u:\PERSONAL\*.sas'; length file $ 50; infile txt filename=file lrecl=80 truncover; informat txt $72.; input txt $ 1-72;; source=file; source=scan(source,-2 );* you will need to edit this statement in order to extract the bits that you need. It is necessary to assign the value from the filename variable to another variable. Nat Wooding Kumar <ravi_pune@YAHOO. COM> To Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU Discussion" cc <SAS-L@LISTSERV.U GA.EDU> Subject Reading Multiple Raw Files .. 01/23/2007 04:55 AM Please respond to Kumar <ravi_pune@YAHOO. COM> Assuming that I have something like this ... filename in ('c:\Test.log', 'c:\Test2.log'); data output; infile in length=len; input record $varying1000. len; run; Is there anyway I can get to know the source of each observation in dataset output? In othe words, I want the dataset 'output' to have another column (say...

Reading Data File with multiple header
I have large numbers of data files, that consist multiple headers and data . For an example : text line 1 1 2 2 3 4 5 text line 2 5 6 4 7 7 2 ..... I need to extract only the data as a matrix format. [header, data] = hdrload(file) does only the 1st header, not the 2nd text lines and onward data sets. Please help me how do I extract all the data sets? If the headers occur at regular intervals then you can use something like... fid = fopen('file_name','rt'); data = []; % create an empty array for your data for i = number_headers_in_setion % ignores header line fgetl(fi...

Re: Reading in Multiple files #5
Change abc to an asterisk and SAS will append all the file HTH On Tue, 10 Feb 2009 00:56:09 -0500, Randy <randistan69@HOTMAIL.COM> wrote: >The code I am using to pull the files in is: > >data test; >Infile 'C:\abc.csv' DLM = ',' >Lrecl = 32000 DSD Truncover; >Input >VarA VarB VarC Juldate; >run; > >/* After this I run some code on it. For example */ >data test ; set test: >n = _N_ ; >run; >/* and so forth */ > >Indeed, I can have one composite file of all the files that I have read in. > All of the variables in all the files are the same. If I do a set I shall >have to type in 1500 file names. Is there a short way to do this? >Any help will be greatly appreciated. ...

Re: SAS data file format ? #5
Look at the SAS OleDb drivers for Windows. They are free and make SAS files appear as an OleDb compliant datasource. SAS does not need to be installed to use this. Alan Alan Churchill Savian www.savian.net -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Capra Hircus Sent: Monday, September 08, 2008 2:34 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: SAS data file format ? Mary wrote: > Capra, > > One trend I've certainly seen in the health care industry, not just in = > SAS but also in moving data between health care systems such as IDX/GE = > to EPIC, is to write data out as XML and then have the recieving system = > read data in as XML. In SAS, one might write it out as follows: > > libname trans xml 'c:\temp\analysis_set.xml' xmltype=3Dgeneric = > tagset=3Dsasxmxsd=20 > XMLMETA=3DSCHEMADATA; > data trans.analysis_set; > set work.analysis_set; > run; > > > It would seem, if you are willing to devote your time to open code, I'd like to be useful. > that = > perhaps a more valuable use of your time would be to ensure that the = > packages your users use, such as R, are able to utilize XML with = > embedded XSD; where it is the XSD that I've found that contains the = > metadata that defines the informats of the variables; thanks to Alan = > Churchill for explaining this. It's an interesting idea. > Then you could simply export yo...

Re: how to read gzip file in SAS #5
filename hhafixed pipe '"C:\Program Files\GnuWin32\bin\gunzip" -c C:\SEERMEDICARE\disk1\hhasaf91.txt.gz'; Path contains a space, need to be double quoted for Winders. I added double quotes around the path above. See if that works. On 11/1/07, wraong <wrong.wang@gmail.com> wrote: > Hi, > I changed filename command as: > > > filename hhafixed pipe 'C:\Program Files\GnuWin32\bin\gunzip -c > C:\SEERMEDICARE\disk1\hhasaf91.txt.gz'; /*reading in a > zipped file*/ > > Then SAS said > 'C:\Program' is not recognized as an internal or external command, operable > program or batch file. > > I tried Start-Run-C:\Program Files\GnuWin32\bin\gunzip , the file can be > open by gzip.exe. > > What else should I do? > > Thanks. > > > > > > > > On 11/1/07, data _null_, <datanull@gmail.com> wrote: > > I think Howard was saying to debug your CALL to Gzip. I expect you > > just need to call it with the full path. C:\your file path\gunzip > > > > open a DOS box to test > > > > On 11/1/07, wraong <wrong.wang@gmail.com> wrote: > > > Hi, Howard, > > > > > > How to debug gunzip? > > > > > > Install *GNU Tar* and *GNU GZip* for Windows. Added "C:\Program > > > Files\GnuWin32\bin" to my Path System variable by going to Control > Panel--> > > > System Propert...

Re: read raw data file from server
Dd sf - You just need to specify the full UNC in the path. Check your server and share names. In my case "HQ-SRV43\GROUPS" is the server name and "INFSYS" is the share name. filename test '\\HQ-SRV43\GROUPS\INFSYS\DataX\PC\Jobs\test.txt'; data _null_; infile test; input; put _infile_; run; Here's a little more information on UNC's: http://compnetworking.about.com/od/windowsnetworking/l/bldef_unc.htm hth Paul Choate DDS Data Extraction (916) 654-2160 > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of df ss > Sent: Friday, June 16, 2006 2:34 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: read raw data file from server > > Hello, > I have a lot of txt file on our server. I want to know how to write the > infile statement in SAS since there is not any letter to identify the > drive name? > Thanks > dd sf > > > --------------------------------- > New Yahoo! Messenger with Voice. Call regular phones from your PC and save > big. ...

Re: Reading PDF Files into SAS #5
I second Nat on this -- I forgot about the 'scanned in' possibility. You will need OCR in that case. -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Nat Wooding Sent: Wednesday, April 01, 2009 11:01 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Reading PDF Files into SAS Mona Are you certain that the pdf was converted from a text or word processing document such as a Word Doc being converted to a PDF. Or, could someone have scanned a paper copy of the document and save this as a PDF. If it is the latter case, you will need to use OCR program to read the image and create a text file. Nat Nat Wooding Environmental Specialist III Dominion, Environmental Biology 4111 Castlewood Rd Richmond, VA 23234 Phone:804-271-5313, Fax: 804-271-2977 Mona <k_monal_99@YAHOO .COM> To Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU Discussion" cc <SAS-L@LISTSERV.U GA.EDU> Subject Re: Reading PDF Files into SAS 04/01/2009 11:55 AM Please respond to Mona <k_monal_99@YAHOO .COM> Thanks Matt and Nat. But when I try to save the PDF to text , nothing gets saved , the text file is totally empty. May be I am doing something wrong. Not Sure. Thanks again for the ideas. CONFIDENTIALITY NOT...

Re: Create SAS file from raw data
Julie: Try this: data Temp; input A $ 1-5; input Test $ 1 @@; do while (Test eq ' '); input B C:$2. D:$8. E:$5. F G H / I J:$3. K:$3. L:$3.; output; input Test $ 1 @@; end; cards; HTH J S Huang >>> "Li,Qian [Ontario]" <Qian.Li@EC.GC.CA> 12/8/2005 12:12:14 PM >>> Hi all, I have to create a SAS file from a raw data formatted as following: 60101 9.44240 O3 P CNSAPR02 12002 1 1 20020501.00000000 20020501.01000000 001 001 001 2.72953 O3 P CNSAPR02 12002 2 2 20020501.00000000 20020501.02000000 001 001 001 2.37352 O3 P CNSAPR02 12002 3 3 20020501.00000000 20020501.03000000 001 001 001 1.86168 O3 P CNSAPR02 12002 4 4 20020501.00000000 20020501.04000000 001 001 001 1.25260 O3 P CNSAPR02 12002 5 5 20020501.00000000 20020501.05000000 001 001 001 0.70932 O3 P CNSAPR02 12002 6 6 20020501.00000000 20020501.06000000 001 001 001 0.57959 O3 P CNSAPR02 12002 7 7 20020501.00000000 20020501.07000000 001 001 001 0.88178 O3 P CNSAPR02 12002 8 8 20020501.00000000 20020501.08000000 001 001 001 1.37837 O3 P CNSAPR02 12002 9 9 20020501.00000000 20020501.09000000 001 001 001 1.71653 O3 P CNSAPR02 12002 10 10 20020501.00000000 20020501.10000000 001 001 001 0.85449 O3 P CNSAPR02 12002 11 11 20020501.00000000 20020501.11000000 001 001 001 1.17...

Re: reading multiple excel files into SAS
What version of SAS are you running? On Wed, 7 Dec 2005 16:56:33 -0500, Ron Nixon <stribnixon@YAHOO.COM> wrote: >I have about 50 excel files I'd like to read into SAS and merge them as they >come in. All of the files have the same layout and the data starts at row >nine in my spreadsheet. I have SAS Access for PC file formats. Can anyone >suggest the correct sytax for doing this. I've just gotten SAS Access and >have not had a chance to use it and the documentation on this is not great. > >Ron ...

Re: Processing Multiple data files #5
On Thu, 23 Aug 2007 13:24:03 -0400, SUBSCRIBE SAS-L Anonymous <randistan69@HOTMAIL.COM> wrote: >On Thu, 23 Aug 2007 03:32:44 -0400, SUBSCRIBE SAS-L Anonymous ><randistan69@HOTMAIL.COM> wrote: > >>Dear All: >> I have multiple files (about 500) in txt format. They are named file1, >>file2 and so on. I am using the following INFILE statement to read the >>data: >> >>Infile 'C:\Documents and Settings\AAA\Desktop\file1.txt' DLM = ',' >>Lrecl = 32000 DSD Truncover; >> >>FInally I want to save the output as Output1, Output2...etc in Mylibrary >> >>So the last line of the code is: >> >>proc sort data = example out = mylibrary.output1 ; by VarA VarB VarC ; >>run; >> >>Can I process the data using a BAT file where I need a wildcard for the >>file1.txt statement and also for the statement out = mylibrary.output1 . >> >>Or will a Macro be be preferred? >> >>Thanx for the help in advance >> Randy > >All: > Every time I read the txt files in I have to type test1, test2 and so on >in the INFILE statement. Besides, the code for each file takes about 30 >minutes to run. That is why I wanted help to determine if I could use a >Macro or use batch processing for these files and save the output as >output1, output2 etc. > Please help. > Randy That's 30 minu...

Re: How to filter sas data sets into separate sas data sets #5
Lizette: Can you show (1) your nested do loops that work for you, and (2) some sample data and the data sets that you desire to get? -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Lizette Koehler Sent: Monday, April 02, 2007 9:53 AM To: SAS-L@LISTSERV.UGA.EDU Subject: How to filter sas data sets into separate sas data sets Listers, This is my failing point in coding SAS. The use of 2 separate SAS data sets to create a third. I can do this in a program with nested Do loops. But with SAS it is just different enough I seem to be unable to see the coding technique. Problem: Sas Data set 1 contains 1 variable and 1000 obs. Sas Data set 2 contains 15 variables and 500000 obs. I need to filter off the data in Sas data set 2 based on Sas data set 1 Node1, Node2 and Node3 must match VAR1 exactly. I have all the code I need to do this except for splitting the data into a separate SAS data set (NEWLISTS). Psuedo code: Sas Data set 1: Var1 Length 7 Char Sas Data set 2: Node1 Length 1-8 Char Node2 Length 1-8 Char Node3 Length 1-8 Char Data Newlist (KEEP=node1 node2 node3 ... var15) Otherds (Keep=node1 node2 node3 .... var15) ; Set SASDS1 ; *Contains 1 var 1000 obs ; Set SASDS2 ; *Contains 15 vars and 500,000 obs ; If Node1 = VAR1 or Node2 = VAR1 or Node3 = Var1 then Output Newlist ; Else Output Otherds ; I have tried putting in two SET statements, but I seem to reduce the information dramatically. ...

Re: help with reading ASCII data into SAS #5
Olive, Try: data a; infile "data.txt" dlm=',' dsd firstobs=2 lrecl=200; input site id pid it $ dd itd rtd linkid sp fc dtc dtm u $; informat dd dtc dtm anydtdtm19. ; format dd dtc dtm datetime21.; informat u $10.; format u $10.; run; HTH, Art -------- On Wed, 5 Nov 2008 11:36:20 -0800, olivesecret@GMAIL.COM wrote: >I tried Andre's code, that is, do not import data from the hard disc >by infile statement, but copy all the data directly to sas using >datalines. You know what? Now it works. So it means there is something >wrong when I use infile statement to import data from the hard disc. >Any suggestions? >Thanks a lot! > > > >On Nov 5, 1:57 pm, bigD <diaphanos...@gmail.com> wrote: >> Andre's code works for the example you gave .... >> >> On Nov 5, 1:20 pm, olivesec...@gmail.com wrote: >> >> > Here is my code: >> >> > data data; >> > infile 'data.txt' delimiter=',' dsd firstobs=2; >> > input site id pid it $ dd itd rtd linkid sp fc dtc dtm u $5. ; >> > run; >> >> > Here is one more obs: >> >> > 1,4,1004,"JS",9/27/2008 0:00:00,1,1,57,11,10,10/3/2008 >> > 11:31:17,10/3/2008= 11:31:17,"AVRC\psuggett" >> >> > Other obs are similar. >> >> > Thank you very much! >> >> > On Nov 5, 12:24 pm, Nord...@DSHS....

Re: Reading in an Excel file with multiple row headers....
On Wed, 3 Jun 2009 13:56:45 -0400, Peter Flom <peterflomconsulting@MINDSPRING.COM> wrote: .... >I have an Excel file where the headers span multiple rows, with some of them using the "merge cells" feature. .... >Is there a way to get SAS to read these in in some sensible fashion? .... hi, if there are less than 10 such files, then i would edit the excel file manually so that each column has suitable header, not merge-celled. then import them into sas. if there are more than 10, then I will write a vba script in office to do this. In other words, not worth trying to tweak ...

Re: SAS Stops Reading Before End of File...Why? #5
I just wanted to go on record supporting Paul's suggestion. HexMad has been a great free utility. Not only does it do its intended job, but can instantly read large files that notepad and wordpad can't even begin to address. The only thing it is missing is a greater than 16 char ASCII view, but that isn't its intended function. Art ------- On Mon, 28 Sep 2009 11:33:32 -0700, Choate, Paul@DDS <pchoate@DDS.CA.GOV> wrote: >Kevin - a nice little free utility to look for DosEOF type gotchas is >HexMad. > >http://download.cnet.com/HexMad/3000-2094_4-10068622.html &...

Re: Creating SAS datasets from reading a file #5
round, flat, hole-in-middle? this wheel has been invented: http://tinyurl.com/5abz5h http://www.sascommunity.org/wiki/Split_Data_into_Subsets Ron Fehd The MetaCode(TM) Maven and the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov > -----Original Message----- > From: owner-sas-l@listserv.uga.edu > [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of SUBSCRIBE > SAS-L Chandra Gadde > Sent: Friday, July 11, 2008 2:57 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Creating SAS datasets from reading a file > > Hi All > > I need your help in creting SAS datasets based on sates in a file. > I need to create sas dataset for each state that is saved in > a file. I have > a file called stlist.del is saved in the following path. > > C:\dwproject\stlist.del > > and the stlist.del file contains the following states. > NY > MD > NJ > CA > VA > PA > > Now I need to create SAS dataset for each state from a given > flat file. > > %macro st_code; > > Data dwproject_&st.; > infile "c:\dwproject\inputfile.del" > input ---- > ---- > --- > ; > where state=&st.; > run; > %mend; > %st_code(); ---->This is wherey I need to get the st values > from the above > mentioned file. > > The output from the above step should be a set of sas > datasets for each > state. > > dwproject_NY; > dwproject_MD; > dwproject_NJ; &g...

Re: Reading in raw text file nasty #5
index on _infile_ that's a good tip! Rgds On Tue, 29 Jan 2008 12:42:41 -0500, LL <lingqun@GMAIL.COM> wrote: >You can use the functions index() or indexw() or find() with _infile_. >For example, you can code something as follow: > >data _; >infile ...; >input ; >retain ...; >if index(_infile_,'...') then do; >... >output; >end; >run; > >All you need is to find the patterns in the raw data which I do think there are. >I processed complex accounting file in this manner, it works well. > >Hope this helps. > >LL > >On Jan 29, 2008 11:36 AM, <vaelta@gmail.com> wrote: >> There aren't that many macro variables in there. >> >> No ideas? What I need from the text is: >> >> Cross sell/Card Activation CPP >> Card Plus v2 Card Act IB@CPP <<<<<<<THIS >> 1 Year >> Policy Acquired Date Sales >> 12/01/2008 <<<<<<<THIS 2 <<<<<<<THIS >> 3 Year >> >> I thought I'd solved it with some other code, but realised that the >> retain was hindering as well as helping: if the channel was not >> present in the format it would just take the last used, from the >> retained value. >> ...

Re: reading in txt file to sas data set
On Mon, 6 Dec 2004 16:33:59 -0800, bw <bcwache@GMAIL.COM> wrote: >Hi, All. > >I'm trying to read in a .txt file that is structured like this: > >Az: .0000 12.00 24.00 >CEA >.00 .4645 1.742 15 >90. .4052 1.035 16 >CIE >.00 .0000 .2742 26 >.90 .0000 .2576 27 > >I'd like the resulting sas data set to have 4 variables and 6 >observations like this: > >az in CEA CIE >.0000 .00 .4645 .0000 >12.00 .00 1.742 .2742 >24.00 .00 15 26 >.0000 90. .4052 .0000 >12.00 90. 1.035 .2576 >24.00 90. 16 27 > >I'm having a heck of a time and would love some help. To make it more >difficult, the number of Az values can vary. In my example the values >are 0, 12, and 24, but it could also be 0, 10, 20, 30, etc. So, I need >it to be flexible enough to handle any number of Az values. Also, the >number of products (CEA, CIE) will vary too. >Any help would be appreciated! Hi, bw, With so many assumptions, here is one way. You said "any" help would be ok... :-) Cheers, Chang %let pwd=%sysfunc(pathname(WORK)); %put NOTE: pwd=&pwd.; x cd "&pwd."; /* create test.txt */ data _null_; input; file "test.txt"; put _infile_; cards; Az: .0000 12.00 24.00 CEA ..00 .4645 1.742 15 90. .4052 1.035 16 /* I^ve fixed this "in" value from .90 to 90.0 */ CIE ..00 .0000 .2742 26 90. .0000 .2576 27 ; run...

Re: MSWord, MailMerge, and reading SAS data #5
Scott, I built an example project showing how to use Visual Studios Tools for Office to bring data from SAS into Excel, all automated. I will build one for Word a little later but the principles will be the same. This is fairly new technology but is extremely robust, scalable, and powerful. You essentially have full control over the entire Office object model. You can download the paper that shows step by step how to do this, code, and screenshots at the following page: http://www.savian.net/utilities.aspx This will get you started in understanding the concepts. I will build a Word one next so it will specifically address your needs. Another possible approach can be found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_wd2003_ ta/html/odc_wd11xml.asp You would need to export SAS as an XML document. This is easily accomplished using the XML libname engine: libname outdata xml 'c:\temp\outdata.xml' ; Thanks, Alan Savian "Bridging SAS and Microsoft Technologies" http://www.savian.net -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Scott Bass Sent: Wednesday, June 15, 2005 3:54 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: MSWord, MailMerge, and reading SAS data Hi Alan and David, Thanks for the replies, much appreciated. More details may be helpful: the end users are medical writers. They don't have SAS, don't know SAS, don't want to know SAS. Right now they cu...

Re: read raw data file from server #2
How do you specify the server, outside of SAS, when you try to copy a file to it? Art ---------- On Fri, 16 Jun 2006 14:33:46 -0700, df ss <tggsun@YAHOO.COM> wrote: >Hello, > I have a lot of txt file on our server. I want to know how to write the infile statement in SAS since there is not any letter to identify the drive name? > Thanks > dd sf > > >--------------------------------- >New Yahoo! Messenger with Voice. Call regular phones from your PC and save big. ...

Re: how to read data in middle of a file? #5 1547482
Jianping, If your goal is to get the numerics out of your file and you don't want to write code to figure out if it is a digit or test then all you need to do is make obs = 14. Otherwise you will need to scan and parse the incoming values from you file. Toby Dunn From: Jianping Zhu <zhujp98@GMAIL.COM> Reply-To: Jianping Zhu <zhujp98@gmail.com> To: SAS-L@LISTSERV.UGA.EDU Subject: how to read data in middle of a file? Date: Thu, 19 May 2005 15:44:35 -0400 data test; infile "C:\t.txt" truncover expandtabs firstobs=10 obs=5; input a b c; run; I want to read line 10-14 of file t.txt but i got 13 data test; 14 infile "C:\t.txt" truncover expandtabs firstobs=10 obs=5; 15 input a b c; 16 run; NOTE: The infile "C:\t.txt" is: File Name=C:\t.txt, RECFM=V,LRECL=256 NOTE: 0 records were read from the infile "C:\t.txt". NOTE: The data set WORK.TEST has 0 observations and 3 variables. NOTE: DATA statement used: real time 0.01 seconds cpu time 0.01 seconds the t.txt looks like this is a test for practice!this is a test for practice!this is a test for practice!this is a test for practice!this is a test for practice!this is a test for practice!this is a test for practice!this is a test for practice! 1 2 3 4 5 6 7 8 9 1 2 2 4 5 6 this is a test for practice! Thanks for help. ...

Web resources about - Re: Reading in multiple raw data files with headers #5 - comp.soft-sys.sas

Multiple sequence alignment - Wikipedia, the free encyclopedia
A multiple sequence alignment (MSA) is a sequence alignment of three or more biological sequences , generally protein , DNA , or RNA . In many ...

Multiple shooting in Pittsburgh, suspects still at large - AdelaideNow Search Search
POLICE are hunting two suspects after at least five people were killed and several more wounded in a multiple shooting at a backyard party in ...

Multiple shooting in Pittsburgh, suspects still at large - The Courier-Mail Search Search
POLICE are hunting two suspects after at least five people were killed and several more wounded in a multiple shooting at a backyard party in ...

Windows 10 Mobile Update: Multiple evidences indicate March 2016 arrival
Microsoft has consistently delayed the arrival of the Windows 10 Mobile update since December 2015, but fresh information indicate that the update ...

Five-car pile-up leaves multiple people in hospital
Five people were taken to hospital&nbsp;following a five car pile up in Canley Vale in Sydney's west on Thursday.

Newly released multiple angle video and photos show Google’s self-driving car accident [Video]
A new video with multiple angles and new pictures of the Google’s self-driving car hitting a bus last week and its aftermath have been released ...

Multiple iOS apps found to be harvesting Snapchat user credentials
... them and change their passwords on the social media platform as soon as possible. New discoveries revealed today point to the fact that multiple ...

Choetech 6 port USB charger: The quick way to charge multiple devices
Having multiple mobile devices is great. Charging them? Not so much. If you need to top the battery on a few smartphones and tablets at the same ...

Science Says: Video Games May Improve Cognitive Abilities In Multiple Sclerosis Patients
... a newly published study claims that some video games may actually be helpful for the more than 2 million people around the world with Multiple ...


Resources last updated: 3/18/2016 11:34:36 AM