home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!DMRHRZ11.BITNET!SCHICK
- Message-ID: <SAS-L%92081717365839@AWIIMC12.IMC.UNIVIE.AC.AT>
- Newsgroups: bit.listserv.sas-l
- Date: Mon, 17 Aug 1992 16:25:40 CET
- Reply-To: Arnold Schick <SCHICK@DMRHRZ11.BITNET>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Arnold Schick <SCHICK@DMRHRZ11.BITNET>
- Subject: Re: Subsetting
- In-Reply-To: Your message of Fri, 14 Aug 1992 09:31:19 EDT
- Lines: 71
-
- On Fri, 14 Aug 1992 09:31:19 EDT Howard Schreier said:
- >
- >CONTENT: Correction/Response
- >SUMMARY: Use selective INPUT to subset variables.
- >
- >> > I need to read a portable sas data file and save it to a SAS DATA
- >> > FILE. This is a huge file. I actually need 1/4 of the variables
- >> > only. How can I save this subset of data file in this step?
- >
- >> With the WHERE clause within a SAS datastep read SAS only those values
- >> into that variables, which are named in this statement.
- >>
- >> i.e. filename file_in 'see operation.dependent:filename\convention';
- >> data one;
- >> where v_nam_01 v_nam_03 v_nam_09-v_nam29 v_nam34-v_nam43 ;
- >> infile file_in;
- >> input v_nam_01-v_nam99 ;
- >> run;
- >
- >I'm afraid that this is wrong in at least three ways. (1)
- >Situation: the WHERE statement is usable when the DATA step
- >is reading SAS data sets rather than external files. (2)
- >Purpose: the WHERE statement is for subsetting observations
- >rather than variables. (3) Syntax: the word "WHERE" must
- >be followed by an expression rather than a variable list.
- >
- >Like the person who posted the earlier response, I assume
- >that "portable sas data file" means an external (non-SAS)
- >file. If instead it means a SAS data set in transport form,
- >the following is not appropriate.
- >
- >To subset variables when reading a huge external file, the
- >best and most straightforward technique is to construct the
- >INPUT statement to selectively read the needed fields only.
- >If the file is not in fixed format (aligned in columns),
- >this is difficult if not impossible. Otherwise, it is done
- >by using either "column" style or "formatted" style (with
- >pointer controls); all of this is described in the section
- >of the SAS Language manual dealing with the INPUT statement.
- >
-
- Yes, Howard Schreier is in right.
-
- I forgot in the 1th example the 2nd datastep for reducing
- the data to the desired variables and, I'm wrong again, it
- needs on the WHERE clause/statement an arithmetic/logical
- expession, and then are observations selected and not
- variables.
-
- This 1th example is to correct with an exchange from WHERE
- to KEEP statement.
-
- In cases of huge files and variable-length is it to reduce by
- pre-processing or on INPUT statement as Howard Schreier refe-
- red, or to read with dummy variables which are not to keep.
- Because it can be the same variable-name, if the last becomes
- the value.
-
- i.e. data one;
- input a b c c d;
- cards;
- 1 2 3 4 5
- 1 2 3 4 5
- 1 2 3 4 5
- ;
-
- Whereas character values within the data complicates sub-
- setting of variables from a huge external file by this
- method, also on missings values.
-
- Arnold Schick University of Marburg/Germany
-