BookmarkSubscribeRSS Feed
feenberg
Calcite | Level 5

Procs import and export print multiple lines in the log file for each variable in the files to be translated. With hundreds of variables it becomes quite a nuisance. I have seen several postings suggesting "options nosource" for suppressing the excess output of the proc import or proc export, but I haven't actually seen it work. There is an example posted on the SAS website that shows it failing to work. If the link doesn't work, try searching for "Example 2: Exporting a Subset of Observations to a CSV File" or see the attachment. Notice the numbered lines include the unwanted printout even though nosource is specified among the options. Is there any solution? All I need is the number of variables and observations - not the source code for the translation itself.

 

 

2 REPLIES 2
r_behata
Barite | Level 11
proc options option=source; *To Check the current value of source option;
run;

option nosource;


proc options option=source; *To Check the current value of source option after reset;
run;


proc export data=sashelp.class (where=(sex='F'))
              outfile="/pathname/Femalelist.csv"
              dbms=csv
               replace;
run;
 
Reeza
Super User

Works fine for me. Perhaps you were doing something incorrect?

 

options nosource;

*Import Data;
proc import out=movies 
		datafile="/home/fkhurshed/MovieLensTest/rawData/movies.csv" dbms=csv replace;
run;

options source;

*Import Data;
proc import out=ratings 
		datafile="/home/fkhurshed/MovieLensTest/rawData/ratings.csv" dbms=csv replace;
run;

LOG:

 

 
 1          OPTIONS NOSYNTAXCHECK;
 2          TITLE;
 3          FOOTNOTE;
 4          OPTIONS LOCALE=en_US DFLANG=LOCALE;
 5          DATA _NULL_;
 6          RUN;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.01 seconds
       system cpu time     0.00 seconds
       memory              460.93k
       OS Memory           20392.00k
       Timestamp           09/09/2019 12:33:53 AM
       Step Count                        20  Switch Count  0
       Page Faults                       0
       Page Reclaims                     26
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 
 7          OPTIONS VALIDVARNAME=ANY;
 8          OPTIONS VALIDMEMNAME=EXTEND;
 9          FILENAME _HTMLOUT TEMP;
 10         FILENAME _PDFOUT TEMP;
 11         FILENAME _GSFNAME TEMP;
 12         FILENAME _DATAOUT TEMP;
 13         %LET SYSCC=0;
 14         %LET _CLIENTAPP='SAS Studio';
 15         %LET _CLIENTAPPABREV=Studio;
 16         %LET _CLIENTAPPVERSION=3.8;
 17         %LET _CLIENTVERSION=3.8;
 18         %LET _CLIENTMODE=wip;
 19         %LET _SASSERVERNAME=%BQUOTE(SASApp);
 20         %LET _SASHOSTNAME=%BQUOTE(odaws04-prod-us);
 21         %LET _SASPROGRAMFILEHOST=%BQUOTE(odaws04-prod-us);
 22         %LET _CLIENTUSERID=%BQUOTE(fkhurshed);
 23         %LET _CLIENTUSERNAME=%BQUOTE(fkhurshed);
 24         %LET CLIENTMACHINE=%BQUOTE(207.34.124.7);
 25         %LET _CLIENTMACHINE=%BQUOTE(207.34.124.7);
 26         %let SASWORKLOCATION="%sysfunc(getoption(work))/";
 27         FILENAME _CWD '.';
 28         DATA _NULL_;
 29         CALL SYMPUT('_SASWORKINGDIR',PATHNAME('_CWD'));
 30         RUN;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              490.31k
       OS Memory           20392.00k
       Timestamp           09/09/2019 12:33:53 AM
       Step Count                        21  Switch Count  0
       Page Faults                       0
       Page Reclaims                     26
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 
 31         FILENAME _CWD;
 NOTE: Fileref _CWD has been deassigned.
 32         
 33         %LET _SASPROGRAMFILE = %NRQUOTE(%NRSTR(Program 1));
 34         %LET _BASEURL = %BQUOTE(https://odamid.oda.sas.com/SASStudio/);
 35         %LET _EXECENV=SASStudio;
 36         DATA _NULL_;
 37         CALL SYMPUT("GRAPHINIT","");
 38         CALL SYMPUT("GRAPHTERM","");
 39         RC=TSLVL('SASXGOPT','N');
 40         _ERROR_=0;
 41         IF (RC^=' ') THEN DO;
 42         CALL SYMPUT("GRAPHINIT","GOPTIONS RESET=ALL GSFNAME=_GSFNAME;");
 43         CALL SYMPUT("GRAPHTERM","GOPTIONS NOACCESSIBLE;");
 44         END;
 45         RUN;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              492.87k
       OS Memory           20392.00k
       Timestamp           09/09/2019 12:33:53 AM
       Step Count                        22  Switch Count  0
       Page Faults                       0
       Page Reclaims                     26
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 
 46         DATA _NULL_;
 47         RC=SYSPROD("PRODNUM002");
 48         IF (RC^=1) THEN DO;
 49         CALL SYMPUT("GRAPHINIT","");
 50         CALL SYMPUT("GRAPHTERM","");
 51         END;
 52         RUN;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              490.87k
       OS Memory           20392.00k
       Timestamp           09/09/2019 12:33:53 AM
       Step Count                        23  Switch Count  0
       Page Faults                       0
       Page Reclaims                     26
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 
 53         %LET _DATAOUT_MIME_TYPE=;
 54         %LET _DATAOUT_NAME=;
 55         %LET _DATAOUT_TABLE=;
 56         %LET _DATAOUT_URL=;
 57         %SYMDEL _DATAOUT_MIME_TYPE _DATAOUT_NAME _DATAOUT_URL _DATAOUT_TABLE;
 58         %LET _SASWS_ = %BQUOTE(/home/fkhurshed);
 59         %LET _SASWSTEMP_=%BQUOTE(/home/fkhurshed/.sasstudio/.images/b81d1e9d-49e0-428f-b298-4a4c7f3c5837);
 60         ODS LISTING CLOSE;
 61         ODS AUTONAVIGATE OFF;
 62         ODS GRAPHICS ON;
 63         ODS HTML5 (ID=WEB) DEVICE=PNG GPATH="&_SASWSTEMP_" ENCODING=utf8  FILE=_HTMLOUT (TITLE='Results: Program 1')
 63       ! STYLE=Htmlblue OPTIONS(BITMAP_MODE='INLINE' OUTLINE='ON' SVG_MODE='INLINE'
 63       ! CSS_PREFIX='.ods_b81d1e9d-49e0-428f-b298-4a4c7f3c5837' BODY_ID='div_b81d1e9d-49e0-428f-b298-4a4c7f3c5837' );
 NOTE: Writing HTML5(WEB) Body file: _HTMLOUT
 64         ODS PDF (ID=WEB) STYLE=Pearl FILE=_PDFOUT;
 NOTE: Writing ODS PDF(WEB) output to DISK destination "_PDFOUT", printer "PDF".
 65         &GRAPHINIT;
 66         OPTIONS FIRSTOBS=1;
 67         OPTIONS OBS=MAX;
 68         OPTIONS DTRESET DATE NUMBER NOTES;
 69         OPTIONS NOSYNTAXCHECK;
 70         
 71         options nosource;
 
 NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to 
 WORK.PARMS.PARMS.SLIST.
 
 NOTE: The infile '/home/fkhurshed/MovieLensTest/rawData/movies.csv' is:
       Filename=/home/fkhurshed/MovieLensTest/rawData/movies.csv,
       Owner Name=fkhurshed,Group Name=oda,
       Access Permission=-rw-r--r--,
       Last Modified=08Aug2019:20:41:32,
       File Size (bytes)=494431
 
 NOTE: 9742 records were read from the infile '/home/fkhurshed/MovieLensTest/rawData/movies.csv'.
       The minimum record length was 19.
       The maximum record length was 208.
 NOTE: The data set WORK.MOVIES has 9742 observations and 3 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.01 seconds
       system cpu time     0.00 seconds
       memory              11312.12k
       OS Memory           38944.00k
       Timestamp           09/09/2019 12:33:53 AM
       Step Count                        24  Switch Count  2
       Page Faults                       0
       Page Reclaims                     458
       Page Swaps                        0
       Voluntary Context Switches        12
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           1800
       
 
 9742 rows created in WORK.MOVIES from /home/fkhurshed/MovieLensTest/rawData/movies.csv.
   
   
   
 NOTE: WORK.MOVIES data set was successfully created.
 NOTE: The data set WORK.MOVIES has 9742 observations and 3 variables.
 NOTE: PROCEDURE IMPORT used (Total process time):
       real time           0.31 seconds
       user cpu time       0.09 seconds
       system cpu time     0.03 seconds
       memory              11312.12k
       OS Memory           39844.00k
       Timestamp           09/09/2019 12:33:53 AM
       Step Count                        24  Switch Count  8
       Page Faults                       0
       Page Reclaims                     7970
       Page Swaps                        0
       Voluntary Context Switches        100
       Involuntary Context Switches      1
       Block Input Operations            968
       Block Output Operations           1888
       
 
 103        
 104        *Import Data;
 105        proc import out=ratings
 106        datafile="/home/fkhurshed/MovieLensTest/rawData/ratings.csv" dbms=csv replace;
 107        run;
 
 NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to 
 WORK.PARMS.PARMS.SLIST.
 108         /**********************************************************************
 109         *   PRODUCT:   SAS
 110         *   VERSION:   9.4
 111         *   CREATOR:   External File Interface
 112         *   DATE:      09SEP19
 113         *   DESC:      Generated SAS Datastep Code
 114         *   TEMPLATE SOURCE:  (None Specified.)
 115         ***********************************************************************/
 116            data WORK.RATINGS    ;
 117            %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
 118            infile '/home/fkhurshed/MovieLensTest/rawData/ratings.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
 119               informat userId best32. ;
 120               informat movieId best32. ;
 121               informat rating best32. ;
 122               informat timestamp best32. ;
 123               format userId best12. ;
 124               format movieId best12. ;
 125               format rating best12. ;
 126               format timestamp best12. ;
 127            input
 128                        userId
 129                        movieId
 130                        rating
 131                        timestamp
 132            ;
 133            if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
 134            run;
 
 NOTE: The infile '/home/fkhurshed/MovieLensTest/rawData/ratings.csv' is:
       Filename=/home/fkhurshed/MovieLensTest/rawData/ratings.csv,
       Owner Name=fkhurshed,Group Name=oda,
       Access Permission=-rw-r--r--,
       Last Modified=08Aug2019:20:41:32,
       File Size (bytes)=2483723
 
 NOTE: 100836 records were read from the infile '/home/fkhurshed/MovieLensTest/rawData/ratings.csv'.
       The minimum record length was 17.
       The maximum record length was 25.
 NOTE: The data set WORK.RATINGS has 100836 observations and 4 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.04 seconds
       user cpu time       0.04 seconds
       system cpu time     0.00 seconds
       memory              10691.90k
       OS Memory           40224.00k
       Timestamp           09/09/2019 12:33:53 AM
       Step Count                        25  Switch Count  2
       Page Faults                       0
       Page Reclaims                     252
       Page Swaps                        0
       Voluntary Context Switches        11
       Involuntary Context Switches      4
       Block Input Operations            2904
       Block Output Operations           6408
       
 
 100836 rows created in WORK.RATINGS from /home/fkhurshed/MovieLensTest/rawData/ratings.csv.
   
   
   
 NOTE: WORK.RATINGS data set was successfully created.
 NOTE: The data set WORK.RATINGS has 100836 observations and 4 variables.
 NOTE: PROCEDURE IMPORT used (Total process time):
       real time           0.11 seconds
       user cpu time       0.09 seconds
       system cpu time     0.01 seconds
       memory              10691.90k
       OS Memory           40740.00k
       Timestamp           09/09/2019 12:33:53 AM
       Step Count                        25  Switch Count  8
       Page Faults                       0
       Page Reclaims                     5391
       Page Swaps                        0
       Voluntary Context Switches        76
       Involuntary Context Switches      4
       Block Input Operations            4856
       Block Output Operations           6424
       
 
 135        
 136        OPTIONS NOSYNTAXCHECK;
 137        ODS HTML CLOSE;
 138        &GRAPHTERM; ;*';*";*/;RUN;QUIT;
 139        QUIT;RUN;
 140        ODS HTML5 (ID=WEB) CLOSE;
 141        
 142        ODS PDF (ID=WEB) CLOSE;
 NOTE: ODS PDF(WEB) printed no output. 
       (This sometimes results from failing to place a RUN statement before the ODS PDF(WEB) CLOSE statement.)
 143        FILENAME _GSFNAME;
 NOTE: Fileref _GSFNAME has been deassigned.
 144        DATA _NULL_;
 145        RUN;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              463.50k
       OS Memory           28588.00k
       Timestamp           09/09/2019 12:33:53 AM
       Step Count                        26  Switch Count  0
       Page Faults                       0
       Page Reclaims                     25
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 
 146        OPTIONS NOTES STIMER SOURCE SYNTAXCHECK;
 147        

 

There's a lot of other stuff because I'm using SAS Studio but it most definitely suppresses the code used. 

 

 


@feenberg wrote:

Procs import and export print multiple lines in the log file for each variable in the files to be translated. With hundreds of variables it becomes quite a nuisance. I have seen several postings suggesting "options nosource" for suppressing the excess output of the proc import or proc export, but I haven't actually seen it work. There is an example posted on the SAS website that shows it failing to work. If the link doesn't work, try searching for "Example 2: Exporting a Subset of Observations to a CSV File" or see the attachment. Notice the numbered lines include the unwanted printout even though nosource is specified among the options. Is there any solution? All I need is the number of variables and observations - not the source code for the translation itself.

 

 


 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 3465 views
  • 0 likes
  • 3 in conversation