Hey guys,
I thougt i was at the end of my journey, but surprise i'm not !
Now that i have my data in a proper data set i want to export it to a .csv file in my computer. But SAS doesn't want to find my file. In fact it telling me that he did it succesfully but nothing appen.
I assume it's because i'm using it by a browse, so it just have the access to the file in his server no ?
And if it's so, how should i do to retrieve my work ?
Thanks for you advice !
options mprint symbolgen mlogic;
proc sql;
%if %sysfunc(exist(WORK.IMPORT5)) %then %do;
drop table WORK.IMPORT5;
%end;
%if %sysfunc(exist(WORK.IMPORT5, VIEW)) %then %do;
drop view WORK.IMPORT5;
%end;
quit;
FILENAME REFFILE FILESRVC
FOLDERPATH="/Users/olivier.perruchet@gmail.com/Zebrys"
FILENAME="integ_narr_1_norm_tiny_1.txt";
PROC IMPORT DATAFILE=REFFILE DBMS=CSV OUT=WORK.IMPORT5;
GETNAMES=no;
DATAROW=1;
RUN;
PROC CONTENTS DATA=WORK.IMPORT5;
RUN;
%macro main;
%DO i=1 %to 2;
%let temps_debut_mean = %sysfunc(time());
proc means data=work.import5 mean;
run;
%let temps_fin_mean = %sysfunc(time());
%let temps_debut_median = %sysfunc(time());
proc means data=work.import5 median;
run;
%let temps_fin_median = %sysfunc(time());
data resultat&i; /* Ici je créer une table résultat pour chaque calcul*/
length step $10;
retain step;
retain duree;
step="Mean";
duree=round(&temps_fin_mean. - &temps_debut_mean., 0.001);
output;
step="Median";
duree=round(&temps_fin_median. - &temps_debut_median., 0.001);
output;
run;
%end;
run;
%Macro EmpilTable; /* Je compile toute mes tables */
Data Combine;
Set %Do I=1 %To 2;
resultat&i.
%End;
;
Run;
%Mend EmpilTable;
/* Je rend la table combien qui contient tous mes calculs */
%EmpilTable %mend;
%main;
/* J'envoie ma table dans mon fichier */
proc export data=combine
outfile="C:\Users\Olivier\Desktop\Zebrys\SAS\CR_2_ETAPE_1.xlsx"
/* this first outfile was my first try to have access to my computer. * /
outfile="C:\Users\Olivier\Desktop\Zebrys\SAS\CR_2_ETAPE_1.xlsx"
/* outfile="Users/olivier.perruchet@gmail.com/Zebrys/resultat.csv" */
DBMS=CSV REPLACE;
delimiter= ";";
run;
MLOGIC(EMPILTABLE): Ending execution. MLOGIC(MAIN): Ending execution. 552 553 /* J'envoie ma table dans mon fichier */ 554 proc export data=combine 555 outfile="C:\Users\Olivier\Desktop\Zebrys\SAS\CR_2_ETAPE_1.xlsx" 556 /* this first outfile was my first try to have access to my computer. * / 557 outfile="C:\Users\Olivier\Desktop\Zebrys\SAS\CR_2_ETAPE_1.xlsx" 558 /* outfile="Users/olivier.perruchet@gmail.com/Zebrys/resultat.csv" */ 559 DBMS=CSV REPLACE; 560 delimiter= ";"; 561 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. 562 /********************************************************************** 563 * PRODUCT: SAS 564 * VERSION: V.03.05 565 * CREATOR: External File Interface 566 * DATE: 07MAY20 567 * DESC: Generated SAS Datastep Code 568 * TEMPLATE SOURCE: (None Specified.) 569 ***********************************************************************/ 570 data _null_; 571 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */ 572 %let _EFIREC_ = 0; /* clear export record count macro variable */ 573 file 'C:\Users\Olivier\Desktop\Zebrys\SAS\CR_2_ETAPE_1.xlsx' delimiter=';' DSD DROPOVER lrecl=32767; 574 if _n_ = 1 then /* write column names or labels */ 575 do; 576 put 577 "step" 578 ';' 579 "duree" 580 ; 581 end; 582 set COMBINE end=EFIEOD; 583 format step $10. ; 584 format duree best12. ; 585 do; 586 EFIOUT + 1; 587 put step $ @; 588 put duree ; 589 ; 590 end; 591 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */ 592 if EFIEOD then call symputx('_EFIREC_',EFIOUT); 593 run; NOTE: The file 'C:\Users\Olivier\Desktop\Zebrys\SAS\CR_2_ETAPE_1.xlsx' is: Filename=/opt/sas/viya/config/var/tmp/compsrv/default/0e1faa35-897a-40c7-9599-d2e1ac3b0ed2/SAS_work047B00002930_sasserver.demo .sas.com/C:\Users\Olivier\Desktop\Zebrys\SAS\CR_2_ETAPE_1.xlsx, Owner Name=olivier.perruchet@gmail.com, Group Name=sas,Access Permission=-rw-r--r--, Last Modified=07May2020:15:56:10 NOTE: 5 records were written to the file 'C:\Users\Olivier\Desktop\Zebrys\SAS\CR_2_ETAPE_1.xlsx'. The minimum record length was 10. The maximum record length was 12. NOTE: There were 4 observations read from the data set WORK.COMBINE. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds 4 records created in C:\Users\Olivier\Desktop\Zebrys\SAS\CR_2_ETAPE_1.xlsx from COMBINE. NOTE: "C:\Users\Olivier\Desktop\Zebrys\SAS\CR_2_ETAPE_1.xlsx" file was successfully created. NOTE: PROCEDURE EXPORT used (Total process time): real time 0.04 seconds cpu time 0.07 seconds 594 595 %studio_hide_wrapper; MLOGIC(STUDIO_HIDE_WRAPPER): Beginning execution. MLOGIC(STUDIO_HIDE_WRAPPER): %GLOBAL _STUDIONOTES MLOGIC(STUDIO_HIDE_WRAPPER): %GLOBAL _STUDIOSOURCE MLOGIC(STUDIO_HIDE_WRAPPER): %GLOBAL _STUDIOSTIMER SYMBOLGEN: Macro variable _STUDIONOTES resolves to MLOGIC(STUDIO_HIDE_WRAPPER): %IF condition &_studionotes = is TRUE MLOGIC(STUDIO_HIDE_WRAPPER): %LET (variable name is _STUDIONOTES) MPRINT(STUDIO_HIDE_WRAPPER): options nonotes; SYMBOLGEN: Macro variable _STUDIOSOURCE resolves to MLOGIC(STUDIO_HIDE_WRAPPER): %IF condition &_studiosource = is TRUE MLOGIC(STUDIO_HIDE_WRAPPER): %LET (variable name is _STUDIOSOURCE) MPRINT(STUDIO_HIDE_WRAPPER): options nosource; SYMBOLGEN: Macro variable _STUDIOSTIMER resolves to MLOGIC(STUDIO_HIDE_WRAPPER): %IF condition &_studiostimer = is TRUE MLOGIC(STUDIO_HIDE_WRAPPER): %LET (variable name is _STUDIOSTIMER) MPRINT(STUDIO_HIDE_WRAPPER): options nostimer; MLOGIC(STUDIO_HIDE_WRAPPER): Ending execution. SYMBOLGEN: Macro variable GRAPHTERM resolves to GOPTIONS NOACCESSIBLE; MLOGIC(STUDIO_RESTORE_WRAPPER): Beginning execution. MLOGIC(STUDIO_RESTORE_WRAPPER): %GLOBAL _STUDIONOTES MLOGIC(STUDIO_RESTORE_WRAPPER): %GLOBAL _STUDIOSOURCE MLOGIC(STUDIO_RESTORE_WRAPPER): %GLOBAL _STUDIOSTIMER SYMBOLGEN: Macro variable _STUDIONOTES resolves to NOTES MPRINT(STUDIO_RESTORE_WRAPPER): options NOTES; SYMBOLGEN: Macro variable _STUDIOSOURCE resolves to SOURCE MPRINT(STUDIO_RESTORE_WRAPPER): options SOURCE; SYMBOLGEN: Macro variable _STUDIOSTIMER resolves to STIMER MPRINT(STUDIO_RESTORE_WRAPPER): options STIMER; MLOGIC(STUDIO_RESTORE_WRAPPER): %LET (variable name is _STUDIONOTES) MLOGIC(STUDIO_RESTORE_WRAPPER): %LET (variable name is _STUDIOSOURCE) MLOGIC(STUDIO_RESTORE_WRAPPER): %LET (variable name is _STUDIOSTIMER) MLOGIC(STUDIO_RESTORE_WRAPPER): Ending execution. 606 607
If you work in a client/server environment, or use a browser to access SAS Studio on a remote server, the file will end up there; either download it (in SAS Studio, find the file in the explorer panel, right-click, and download) from within SAS, or use a file transfer utility (like WinSCP) to copy the file.
If you use Enterprise Guide, it provides a File Copy task for this.
So you don't find the file at:
C:\Users\Olivier\Desktop\Zebrys\SAS\CR_2_ETAPE_1.xlsx
SAS log is rarely wrong about stuff like that.
If you are operating on a server, you can usually right click the file and download or use the COPY FILE task in EG to move the file to your local drive. I think if you're using Base SAS and have it locally installed you can work both on the server or locally with no issue - one reason I preferred Base over EG but a security issue at some companies.
If you work in a client/server environment, or use a browser to access SAS Studio on a remote server, the file will end up there; either download it (in SAS Studio, find the file in the explorer panel, right-click, and download) from within SAS, or use a file transfer utility (like WinSCP) to copy the file.
If you use Enterprise Guide, it provides a File Copy task for this.
PS since you create a text file with a delimiter, you should NOT name it with a .xlsx extension; at least use .csv.
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 25. Read more here about why you should contribute and what is in it for you!
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.