f



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 '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
>


--
WenSui Liu
(http://spaces.msn.com/statcompute/blog)
Senior Decision Support Analyst
Health Policy and Clinical Effectiveness
Cincinnati Children Hospital Medical Center
0
liuwensui (937)
5/19/2006 4:16:24 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
325 Views

Similar Articles

[PageSpeed] 0

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 #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 ...

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...

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 #4
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: 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: read Access data in SAS #4
You can use PROC IMPORT. Here is some sample code for SAS (doesn't work the same for EG I have found): proc import database = 'Accessfilename' datatable = 'AccessTable' out = datasetname dbms = access replace; run; Replace the italicized text with your pertinent info. Hope this helps, Nancy >>> Kevin Viel <kviel@SFBRGENETICS.ORG> 10/12/2007 10:08:36 AM >>> > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On > Behalf Of Little T > Sent: Thursday, October 11, 2007 8:14 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: read Access data in SAS > > Guys, I was given a Access data file to do some analysis. Can > anyone share your idea or code of how to read Access data in > SAS. Do I have to go into Access and export or do Import in SAS? I favor DDE. I prefer to list each variable, but my datasets are typically small or contain the same type of variables... Kevin Viel, PhD Post-doctoral fellow Department of Genetics Southwest Foundation for Biomedical Research San Antonio, TX 78227 ...

Re: SAS data file format ? #4
Do those work with SAS data sets that are more than 256 fields? Can = Office Excel 2007 import data using such a driver? -Mary ----- Original Message -----=20 From: Alan Churchill=20 To: SAS-L@LISTSERV.UGA.EDU=20 Sent: Monday, September 08, 2008 3:44 PM Subject: Re: SAS data file format ? 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 ...

Re: how to read data in middle of a file? #4
Jianping - The online doc - OBS=record-number | MAX record-number specifies the record number of the last record to read in an input file that is read sequentially. Try infile "C:\t.txt" truncover expandtabs firstobs=10 obs=14; By the way - your data are character, so you might also want input a $ b $ c $; hth Paul Choate DDS Data Extraction (916) 654-2160 -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Jianping Zhu Sent: Thursday, May 19, 2005 12:45 PM To: SAS-L@LISTSERV.UGA.EDU Subject: how to read data in middle of a file? 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 ...

Re: Processing Multiple data files #4
You missed the point, which was SAS can already do this without having to resort to a macro: http://support.sas.com/techsup/technote/ts581.html Toby Dunn Two wrongs are only the beginning. Success always occurs in private and failure in full view. Experience is something you don't get until just after you need it. From: SUBSCRIBE SAS-L Anonymous <randistan69@HOTMAIL.COM> Reply-To: SUBSCRIBE SAS-L Anonymous <randistan69@HOTMAIL.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Processing Multiple data files Date: Thu, 23 Aug 2007 13:24:03 -0400 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...

Re: Reading in multiple EXCEL files #4
Howard, Its already been suggested that you can develop a macro or take advantage of either dde or the libname statement. What you actually use, of course, will be dependent on how similar the files are in both form and contents, whether you have the SAS/Access product that Howard mentioned, and your preferences regarding sql, the SAS data step, scl, call execute, and include files. I happen to prefer include files thus will provide an example based on them. Specifically, the following example assumes you have a group of Excel files in the same directory, all with worksheets that have the worksheet of interest titled 'Sheet1', and that you want to import all of them and concatenate them into one SAS file titled 'All'. Hopefully, if the example is close to what you were seeking, you will be able to modify it to meet your actual needs. Art filename fh pipe 'dir /q "c:\Howard Alper\directory\*.xls"'; filename GetXLS temp ; data _null_; file GetXLS; infile fh lrecl=300 truncover firstobs=6 end=eof; input date mmddyy10. @13 time $8. @29 size $10. @63 filename $40.; if date ne . then do; filename=" 'c:\Howard Alper\directory\"|| trim(left(filename))||"'"; counter+1; ExcelName='Excel'||put(counter,z3.); put @1 "libname " ExcelName filename "header=yes;"; end; if eof then do; put @1 'data all;'; put @3 'set '; do i=1 to counte...

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 PDF Files into SAS #4
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. ...

Re: Reading SAS files from other programs #4
JMP started as a SAS-like Macintosh product at SAS when they had a demand for a product on the Mac platform but apparently did not want to try a full port. The joke around SUGIs was that JMP stood for John's Macintosh Product. The "John" being John Sall who lead the effort at SAS. Nat Wooding Jim Groeneveld <jim2stat@YAHOO.C O.UK> To Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU Discussion" cc <SAS-L@LISTSERV.U GA.EDU> Subject Re: Reading SAS files from other programs 04/28/2006 03:40 AM Please respond to Jim Groeneveld <jim2stat@YAHOO.C O.UK> Hi Mark, In addition to my previous reply I can add, that though the SAS dataset specification is proprietary, not published and officially unknown, other software vendors have succeeded in analyzing it to read SAS datasets directly. The original author of DBMS/copy, Henry Feldman, did so a long time ago already, and his software has been used widely. Now that his company has been bought by SAS that 'problem' has disappeared. Something similar happened to the software package JM...

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: how to read gzip file in SAS #4
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 Properties --> Advanced Tab--> Environment Variables > > > > Did I added wrong path? > > > > Thanks. > > > > Best, > > Rong > > > > > > > > On 11/1/07, Howard Schreier <hs AT dc-sug DOT org> <nospam@howles.com> > > wrote: > > > > > > On Thu, 1 Nov 2007 12:21:58 -0400, wraong <wrong.wang@GMAIL.COM> > wrote: > > > > > > >Hi,all, > > > > > ...

Re: How to filter sas data sets into separate sas data sets #4
Something like this is the old way. You could use a proc sql if you have a new enough version. Increase your buffersize and if you have enough memory you may get it into a hash routine. DATA WORK.NEW; MERGE small (IN=A OBS=500) big ; BY ID_FIELD; IF A=1; RUN; QUIT; RICH -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@listserv.vt.edu] On Behalf Of Lizette Koehler Sent: Monday, April 02, 2007 10:53 AM To: SAS-L@LISTSERV.VT.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 No...

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: Reading a file and Creating SAS datasets #4
Mike , A Hash solution would do it in one step. Toby Dunn "Don't bail. The best gold is at the bottom of barrels of crap." Randy Pausch "Be prepared. Luck is where preparation meets opportunity." Randy Pausch > Date: Mon, 12 May 2008 17:52:15 -0400 > From: msz03@ALBANY.EDU > Subject: Re: Reading a file and Creating SAS datasets > To: SAS-L@LISTSERV.UGA.EDU > > hi ... though I do not use CALL EXECUTE very often, I think that this is task where it might be of > use ... here's an example using SASHELP.ZIPCODE that contains a variable (STATECODE) with values > of the standard two-letter state abbreviations ... it reads instream data but could just as easily > read the state codes from an external file or a data set ... > > data _null_; > input state $2.; > call execute(cat( > > 'data ',state, ';', > 'set sashelp.zipcode;', > 'where statecode eq "',state,'";', > 'run;' > > )); > datalines; > NY > AL > AK > ; > run; > > -- > Mike Zdeb > U@Albany School of Public Health > One University Place > Rensselaer, New York 12144-3456 > P/518-402-6479 F/630-604-1475 > >> Thank you Jane. It really helped me a lot. >> >> >> On Mon, 12 May 2008 15:46:42 -0400, SUBSCRIBE SAS-L Jane Xue >> wrote: >> >>>Wish this could hlep some: >>> >>>DATA s...

Re: reading multiple excel files into SAS #2
************************************************* * READ ALL EXCEL FILES WITH SAME STRUCTURE * * FROM A FOLDER INTO SAS USING MACRO * * DATE: SEP-29, 2005 * *************************************************; %macro ReadXls(dir =3D , out =3D ); ************************************************* * MACRO PARAMETERS: * * DIR: FOLDER WHERE DATA IS STORED * * OUT: NAME OF OUTPUT DATA TABLE * *************************************************; /* DELETE TABLE WITH SAME NAME AS OUTPUT DATA */ proc datasets; delete &out; run; quit; /* MANIPULATION THE STRING OF FOLDER PATH */ data _null_; dir1 =3D...

Re: Reading in raw files and concatenating text #4
Summary: Use View to handle BY processing of sorted external data #iw-value=2 Paula, Nothing wrong with some of the answers you already have, but the opportunity is too good to not point out the advantage of a view. First create data. filename q temp ; data _null_ ; input ; file q ; put _infile_ ; cards4; 1234;1; ; ; ; ; ;Four score and seven years ago our fathers brought; 1234;2; ; ; ; ; ;forth on this continent, a new nation, conceived in 1234;3; ; ; ; ; ;Liberty, and dedicated to the proposition that all; 1234;4; ; ; ; ; ;men are created equal; 2345;1; ; ; ; ; ;To be or not to be; 3456;1; ; ; ; ; ;When in the course of human events it becomes; 3456;2; ; ; ; ; ;necessary for one people to dissolve the political; ;;;; Now we have a file as you describe. Make the view (no data pass). data v (drop=skip)/ view=v ; infile q dsd dlm=";" ; input id $ seq skip $ skip $ skip $ skip $ skip $ ln :$80. ; run ; Use the view with standard SAS tools. data w ( drop = seq ln ) ; length line $ 1000 ; do until ( last.id ) ; set v ; by id seq ; line = trim(line) || " " || ln ; end ; run ; I would use CATX function in version 9 to combine the lines, but I am working at a computer with only 8.2. Ian Whitlock ============== Date: Wed, 27 Sep 2006 00:40:20 GMT Reply-To: Paula Sims <me@HERE.COM> Sender: "SAS(r) ...

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 ...

Web resources about - Re: Reading in multiple raw data files with headers #4 1553854 - 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:35:55 AM