I created and ran this file %let outpath=filepath-to-output-folder;
to create a macrovariable for the the outpath folder. However, when I run this code
proc export data=pg1.storm_final outfile="&outpath/storm_final.csv" dbms=csv replace; run;
I receive this error message.
OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 70 71 %let outpath=filepath-to-output-folder; 72 73 proc export data=pg1.storm_final 74 outfile="&outpath/storm_final.csv" 75 dbms=csv replace; 76 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. 77 /********************************************************************** 78 * PRODUCT: SAS 79 * VERSION: 9.4 80 * CREATOR: External File Interface 81 * DATE: 14OCT22 82 * DESC: Generated SAS Datastep Code 83 * TEMPLATE SOURCE: (None Specified.) 84 ***********************************************************************/ 85 data _null_; 86 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */ 87 %let _EFIREC_ = 0; /* clear export record count macro variable */ 88 file 'filepath-to-output-folder/storm_final.csv' delimiter=',' DSD DROPOVER lrecl=32767; 89 if _n_ = 1 then /* write column names or labels */ 90 do; 91 put 92 "Season" 93 ',' 94 "Name" 95 ',' 96 "Basin" 97 ',' 98 "BasinName" 99 ',' 100 "OceanCode" 101 ',' 102 "Ocean" 103 ',' 104 "StormType" 105 ',' 106 "MaxWindMPH" 107 ',' 108 "MaxWindKM" 109 ',' 110 "MinPressure" 111 ',' 112 "StartDate" 113 ',' 114 "EndDate" 115 ',' 116 "StormLength" 117 ',' 118 "Lat" 119 ',' 120 "Lon" 121 ; 122 end; 123 set PG1.STORM_FINAL end=EFIEOD; 124 format Season best4. ; 125 format Name $char57. ; 126 format Basin $char2. ; 127 format BasinName $14. ; 128 format OceanCode $2. ; 129 format Ocean $8. ; 130 format StormType $13. ; 131 format MaxWindMPH best12. ; 132 format MaxWindKM 3. ; 133 format MinPressure best12. ; 134 format StartDate date9. ; 135 format EndDate date9. ; 136 format StormLength best12. ; 137 format Lat best12. ; 138 format Lon best12. ; 139 do; 140 EFIOUT + 1; 141 put Season @; 142 put Name $ @; 143 put Basin $ @; 144 put BasinName $ @; 145 put OceanCode $ @; 146 put Ocean $ @; 147 put StormType $ @; 148 put MaxWindMPH @; 149 put MaxWindKM @; 150 put MinPressure @; 151 put StartDate @; 152 put EndDate @; 153 put StormLength @; 154 put Lat @; 155 put Lon ; 156 ; 157 end; 158 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */ 159 if EFIEOD then call symputx('_EFIREC_',EFIOUT); 160 run; ERROR: Physical file does not exist, /pbr/biconfig/940/Lev1/SASApp/filepath-to-output-folder/storm_final.csv. NOTE: The SAS System stopped processing this step because of errors. NOTE: There were 1 observations read from the data set PG1.STORM_FINAL. 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 9684.28k OS Memory 39976.00k Timestamp 10/14/2022 10:04:54 PM Step Count 134 Switch Count 0 Page Faults 0 Page Reclaims 103 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 8 0 records created in filepath-to-output-folder/storm_final.csv from PG1.STORM_FINAL. NOTE: "filepath-to-output-folder/storm_final.csv" file was successfully created. NOTE: PROCEDURE EXPORT used (Total process time): real time 0.04 seconds user cpu time 0.03 seconds system cpu time 0.01 seconds memory 9684.28k OS Memory 40236.00k Timestamp 10/14/2022 10:04:54 PM Step Count 134 Switch Count 7 Page Faults 0 Page Reclaims 1370 Page Swaps 0 Voluntary Context Switches 70 Involuntary Context Switches 0 Block Input Operations 288 Block Output Operations 64 161 162 proc export data=pg1.storm_final 163 outfile="&outpath/storm_final.csv" 164 dbms=csv replace; 165 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. 166 /********************************************************************** 167 * PRODUCT: SAS 168 * VERSION: 9.4 169 * CREATOR: External File Interface 170 * DATE: 14OCT22 171 * DESC: Generated SAS Datastep Code 172 * TEMPLATE SOURCE: (None Specified.) 173 ***********************************************************************/ 174 data _null_; 175 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */ 176 %let _EFIREC_ = 0; /* clear export record count macro variable */ 177 file 'filepath-to-output-folder/storm_final.csv' delimiter=',' DSD DROPOVER lrecl=32767; 178 if _n_ = 1 then /* write column names or labels */ 179 do; 180 put 181 "Season" 182 ',' 183 "Name" 184 ',' 185 "Basin" 186 ',' 187 "BasinName" 188 ',' 189 "OceanCode" 190 ',' 191 "Ocean" 192 ',' 193 "StormType" 194 ',' 195 "MaxWindMPH" 196 ',' 197 "MaxWindKM" 198 ',' 199 "MinPressure" 200 ',' 201 "StartDate" 202 ',' 203 "EndDate" 204 ',' 205 "StormLength" 206 ',' 207 "Lat" 208 ',' 209 "Lon" 210 ; 211 end; 212 set PG1.STORM_FINAL end=EFIEOD; 213 format Season best4. ; 214 format Name $char57. ; 215 format Basin $char2. ; 216 format BasinName $14. ; 217 format OceanCode $2. ; 218 format Ocean $8. ; 219 format StormType $13. ; 220 format MaxWindMPH best12. ; 221 format MaxWindKM 3. ; 222 format MinPressure best12. ; 223 format StartDate date9. ; 224 format EndDate date9. ; 225 format StormLength best12. ; 226 format Lat best12. ; 227 format Lon best12. ; 228 do; 229 EFIOUT + 1; 230 put Season @; 231 put Name $ @; 232 put Basin $ @; 233 put BasinName $ @; 234 put OceanCode $ @; 235 put Ocean $ @; 236 put StormType $ @; 237 put MaxWindMPH @; 238 put MaxWindKM @; 239 put MinPressure @; 240 put StartDate @; 241 put EndDate @; 242 put StormLength @; 243 put Lat @; 244 put Lon ; 245 ; 246 end; 247 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */ 248 if EFIEOD then call symputx('_EFIREC_',EFIOUT); 249 run; ERROR: Physical file does not exist, /pbr/biconfig/940/Lev1/SASApp/filepath-to-output-folder/storm_final.csv. NOTE: The SAS System stopped processing this step because of errors. NOTE: There were 1 observations read from the data set PG1.STORM_FINAL. 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 9698.56k OS Memory 39976.00k Timestamp 10/14/2022 10:04:54 PM Step Count 135 Switch Count 0 Page Faults 0 Page Reclaims 100 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 0 0 records created in filepath-to-output-folder/storm_final.csv from PG1.STORM_FINAL. NOTE: "filepath-to-output-folder/storm_final.csv" file was successfully created. NOTE: PROCEDURE EXPORT used (Total process time): real time 0.03 seconds user cpu time 0.04 seconds system cpu time 0.00 seconds memory 9698.56k OS Memory 40236.00k Timestamp 10/14/2022 10:04:54 PM Step Count 135 Switch Count 7 Page Faults 0 Page Reclaims 1155 Page Swaps 0 Voluntary Context Switches 60 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 32 250 251 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 262
Thank you for your response, I am still having difficulty. I when to properties for the output folder to receive the file path name and this is the code I used.
%let outpath=/home/u60771588/EPG1V2/outputfilepath-to-output-folder; proc export data=pg1.storm_final outfile="@outpath/storm_final.csv" dbms =csv replace; run
%let outpath=/home/u60771588/EPG1V2/output;
proc export data=pg1.storm_final
outfile="&outpath/storm_final.csv"
dbms =csv replace;
run
Issues are highlighted below and fixed above.
@Sassy_lady wrote:
Thank you for your response, I am still having difficulty. I when to properties for the output folder to receive the file path name and this is the code I used.
%let outpath=/home/u60771588/EPG1V2/outputfilepath-to-output-folder; proc export data=pg1.storm_final outfile="@outpath/storm_final.csv" dbms =csv replace; run
Thank you! I went to properties for the output folder again and I have no idea why I included "filepath-to-output-folder".
Then the "@" verse "&" sometimes I miss the small details, they make a big difference. Thank you again, there's no error message now.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.