LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 5 Jul 2005 19:27:06 -0600
Reply-To:     Alan Churchill <SASL001@SAVIAN.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Alan Churchill <SASL001@SAVIAN.NET>
Subject:      Re: Exporting specific data to csv
Comments: To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
In-Reply-To:  <200507060116.j661GNKO000484@listserv.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"

This is an important question. Which procs don't support dataset options? Does anyone know? I assumed tht all procs would allow dataset options on the read but this is obviously wrong.

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 Howard Schreier <hs AT dc-sug DOT org> Sent: Tuesday, July 05, 2005 6:16 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Exporting specific data to csv

... and it turns out that PROC EXPORT, at least with CSV as the target, simply does not accept data set options. If they are coded, one sees in the log: "WARNING: This DBMS type does not support Data Set options. The options entered will be ignored."

So an intermediate data set (or view) is needed.

Can anybody explain *why* the structure on the output side (CSV) interferes with support of data set options on the source side. I can't see it.

On Fri, 1 Jul 2005 16:47:48 -0400, Howard Schreier <hs AT dc-sug DOT org> <nospam@HOWLES.COM> wrote:

>I did not test my code, and it's been pointed out to me that my third >example will not work because WHERE= cannot reference a variable which has >been shed by means of KEEP= or DROP=. > >So in that case an intermediate data set would be needed. If the volume is >large, one might want to save a pass by making it a view. Something like >(still not tested): > > data subset < / view=subset > ; > set sashelp.class; > where sex='F'; > run; > > proc export data=subset (KEEP = NAME AGE) > outfile='c:\sas\class.txt' > dbms=csv replace; > run; > >On Fri, 1 Jul 2005 09:06:43 -0400, Howard Schreier <hs AT dc-sug DOT org> ><nospam@HOWLES.COM> wrote: > >>Simply use data set options to subset. For example: >> >> proc export data=sashelp.class (KEEP = NAME AGE) >> outfile='c:\sas\class.txt' >> dbms=csv replace; >> >>or >> >> proc export data=sashelp.class (WHERE = (SEX='F') ) >> outfile='c:\sas\class.txt' >> dbms=csv replace; >> >>or >> >> proc export data=sashelp.class (KEEP = NAME AGE WHERE = (SEX='F') ) >> outfile='c:\sas\class.txt' >> dbms=csv replace; >> >>On Fri, 1 Jul 2005 05:00:14 -0400, Chris Brooks <Chris.Brooks@ONS.GOV.UK> >>wrote: >> >>>Vinoth >>> >>>To export only a subset of observations you can use the following options >>>statement >>> >>>options obs=10; >>>proc export data=sashelp.class >>> outfile='c:\sas\class.txt' >>> dbms=csv replace; >>> >>>run; >>> >>>This will export only the first 10 observations >>> >>>If you want to export only a subset of variables you could use File >Export- >>>Data and select User-Defined Formats. This will allow you to exclude >>>unwanted variables from the exported file. Alternatively create a new data >>>set by dropping unwanted variables/observations and export that. >>> >>>Chris >>> >>>Chris Brooks >>>Office for National Statistics >>>United Kingdom >>> >>> >>>On Fri, 1 Jul 2005 09:45:04 +0100, vinoth babu <way2vb@YAHOO.COM> wrote: >>> >>>>Hi, >>>> >>>>I have a dataset which has 700 variables. can i export >>>>only 10 variables to csv? >>>> >>>>Is there any front end to get specific variables? >>>> >>>>Thanks & Regards, >>>> >>>>Vinothbabu E. >>>> >>>> >>>> >>>>Send instant messages to your online friends >http://in.messenger.yahoo.com


Back to: Top of message | Previous page | Main SAS-L page