Hello,
I'm trying to split and export one dataset into multiple excel files using the filevar option (name of file should correspont to the split criteria).
This is what my code looks like:
filename my_file "C:\temp\dummy.csv";
/*sort dataset*/
proc sort data=WORK.QUERY_FOR_TRNSTRANSPOSEDQUE_0005 out=WORK.QUERY_FOR_TRNSTRANSPOSEDQUE_0005;
by KBA_Herst;
run;
data _Null_ ;
set WORK.QUERY_FOR_TRNSTRANSPOSEDQUE_0005;
length out_name $ 64;
/*create name of output file */
out_name = "C:\temp\"||compress(put(KBA_Herst,z.))||".csv";
file my_file filevar=out_name;
put _all_ ;
run ;
Pretty straight forward actually... The SAS log shows me, that the name and path of the output file is put together correctly.
Sure I checked if the path C:\temp\ is correct and available.
However I get an error saying the physical file does not exist.
Just for the sake of it, I created the first file manually and put it in C:\temp\. Still I get the same error message.
Running SAS EG 6.1 on WIN7 64 bit. MS Office 2010.
Any help on this would be greatly appreciated.
LOG:
1 | ;*';*";*/;quit;run; |
2 | OPTIONS PAGENO=MIN; |
3 | %LET _CLIENTTASKLABEL='Code für Abfrage erstellen'; |
4 | %LET _CLIENTPROJECTPATH='W:\CG\06_EnterpriseGuide\EG_Projekte\CG-GB_Lohndaten_Qualifizierung_CSC_20150513.egp'; |
5 | %LET _CLIENTPROJECTNAME='CG-GB_Lohndaten_Qualifizierung_CSC_20150513.egp'; |
6 | %LET _SASPROGRAMFILE=; |
7 | |
8 | ODS _ALL_ CLOSE; |
9 | OPTIONS DEV=ACTIVEX; |
10 | GOPTIONS XPIXELS=0 YPIXELS=0; |
11 | FILENAME EGSR TEMP; |
12 | ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR |
13 | STYLE=HtmlBlue |
14 | STYLESHEET=(URL="file:///C:/Program%20Files/SASHome94/SASEnterpriseGuide/6.1/Styles/HtmlBlue.css") |
15 | NOGTITLE |
16 | NOGFOOTNOTE |
17 | GPATH=&sasworklocation |
18 | ENCODING=UTF8 |
19 | options(rolap="on") |
20 | ; |
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
21 | |
22 | GOPTIONS ACCESSIBLE; |
23 | filename my_file "C:\temp\dummy.csv"; |
24 | |
25 | /*sort dataset*/ |
26 | |
27 | proc sort data=WORK.QUERY_FOR_TRNSTRANSPOSEDQUE_0005 out=WORK.QUERY_FOR_TRNSTRANSPOSEDQUE_0005; |
28 | |
29 | by KBA_Herst; |
30 | |
31 | run; |
NOTE: Input data set is already sorted; it has been copied to the output data set.
NOTE: There were 450284 observations read from the data set WORK.QUERY_FOR_TRNSTRANSPOSEDQUE_0005.
NOTE: The data set WORK.QUERY_FOR_TRNSTRANSPOSEDQUE_0005 has 450284 observations and 14 variables.
NOTE: Compressing data set WORK.QUERY_FOR_TRNSTRANSPOSEDQUE_0005 decreased size by 97.01 percent.
Compressed is 337 pages; un-compressed would require 11258 pages. |
NOTE: PROZEDUR SORT used (Total process time):
real time | 3.90 seconds | |
cpu time | 3.86 seconds | |
32 | ||
33 | data _Null_ ; | |
34 | ||
35 | set WORK.QUERY_FOR_TRNSTRANSPOSEDQUE_0005; | |
36 | ||
37 | length out_name $ 64; | |
38 | ||
39 | /*create name of output file */ | |
40 | ||
41 | out_name = "C:\temp\"||compress(put(KBA_Herst,z.))||".csv"; | |
42 | ||
43 | file my_file filevar=out_name; | |
44 | ||
45 | put _all_ ; | |
46 | ||
2 | Das SAS System | 08:56 Wednesday, May 13, 2015 |
47 | run ; |
ERROR: Physische Datei existiert nicht, C:\temp\5.csv.
SYSTEM=EU KBA_Herst=5 KBA_Typ=AMH Modell=R 1200 GS R 1200 GS Kilowatt=77 Hubraum=1170 KZ_Baugruppe=EA KZ_Bauteil=74
Ersatzteil_Kombination=16 14 7 675 547 Anzahl=95 Datum_Erstzulassung_von=03.2007 Datum_Erstzulassung_bis=05.2010
Datum_Schadenseintritt_von=07.2011 Datum_Schadenseintritt_bis=10.2014 out_name=C:\temp\5.csv _ERROR_=1 _N_=1
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 1 observations read from the data set WORK.QUERY_FOR_TRNSTRANSPOSEDQUE_0005.
NOTE: DATA statement used (Total process time):
real time | 0.00 seconds | |
cpu time | 0.01 seconds | |
48 | |
49 | GOPTIONS NOACCESSIBLE; |
50 | %LET _CLIENTTASKLABEL=; |
51 | %LET _CLIENTPROJECTPATH=; |
52 | %LET _CLIENTPROJECTNAME=; |
53 | %LET _SASPROGRAMFILE=; |
54 | |
55 | ;*';*";*/;quit;run; |
56 | ODS _ALL_ CLOSE; |
57 | |
58 | |
59 | QUIT; RUN; |
60 |
Are you running the code on the local SAS installation or on some SAS Server somewhere else. this might explain, why there is no c:\temp
Are you running the code on the local SAS installation or on some SAS Server somewhere else. this might explain, why there is no c:\temp
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: