Hi all,
DATA _NULL_; HOME = SYSGET("SAS_HOME"); ATTRIB TASK FORMAT=$2000.; TASK = """" !! STRIP(HOME) !! "\SASPlatformObjectFramework\9.4\tools\sas-list-objects.exe"" -host ""&G_METASERVER."" -port ""&G_METAPORT.""" !! " -user ""&G_METAUSER"" -password ""&G_METAPASS"" -domain ""DefaultAuth""" !! " -types ""&LIST_OF_TYPES."" -format csv " !! " > C:\Users\sasdemo\md_ojects_list.csv" ; CALL SYSTEM(TASK); RUN;If I run the generated command line in command window directly, then the CSV file is generated
"C:\Program Files\SASHome\SASPlatformObjectFramework\9.4\tools\sas-list-objects.exe" -host "localhost" -port "8561" -user "sasdemo" -password "Meta#2019" -domain "DefaultAuth" -types "ACT" -format csv > C:\Users\sasdemo\md_ojects_list.csv
Remove the redirection from the end of the command and try running the command using a pipe instead and see what output it generates. Something like:
data _null_;
command = catx(.......);
infile dummy pipe filevar=command ;
input;
put _infile_;
run;
The TASK looks like
"C:\Program Files\SASHome\SASPlatformObjectFramework\9.4\tools\sas-list-objects.exe" -host "localhost" -port "8561" -user "sasdemo" -password "Meta#2019" -domain "DefaultAuth" -types "ACT" -format csv > C:\Users\sasdemo\md_ojects_list.csv
Ther error message I have in German only.
Der Befehl "C:\Program" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
This is the translation
The command "C:\Program" is either written incorrectly or
could not be found.
Regards,
Christoph
Additional information:
It seems to me that the problem is the start of command line
"C:\Program Files\
the error occurs because of the blank after "C:\Program "
But I have quoted the call of program with the blank in the path.
Regards,
Christoph
this is the log in German language
Der Befehl "C:\Program" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
"Log" means the log text of the whole step, including line numbers etc.
1 The SAS System 17:17 Friday, September 27, 2019 1 ;*';*";*/;quit;run; 2 OPTIONS PAGENO=MIN; 3 %LET _CLIENTTASKLABEL='Program (3)'; 4 %LET _CLIENTPROCESSFLOWNAME='Process Flow'; 5 %LET _CLIENTPROJECTPATH=''; 6 %LET _CLIENTPROJECTPATHHOST=''; 7 %LET _CLIENTPROJECTNAME=''; 8 %LET _SASPROGRAMFILE=''; 9 %LET _SASPROGRAMFILEHOST=''; 10 11 ODS _ALL_ CLOSE; 12 OPTIONS DEV=PNG; 13 GOPTIONS XPIXELS=0 YPIXELS=0; 14 FILENAME EGSR TEMP; 15 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR 16 STYLE=HTMLBlue 17 STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HTMLBlue.css") 18 NOGTITLE 19 NOGFOOTNOTE 20 GPATH=&sasworklocation 21 ENCODING=UTF8 22 options(rolap="on") 23 ; NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR 24 25 GOPTIONS ACCESSIBLE; 26 %let list_of_types=ACT; 27 %let files_folder=C:\Benutzer\sademo;; 28 %let G_METASERVER=sas01; 29 %let G_METAPORT=8561; 30 %let G_METAUSER=sasdemo; 31 %let G_METAPASS=xxxxxxxx; 32 33 options noxwait; 34 /* 35 %macro BY_GET_METADATA_OBJECTS_LIST; 36 DATA test; 37 HOME = %str(SYSGET("SAS_HOME")); 38 ATTRIB TASK FORMAT=$2000.; 39 TASK = """" !! %str(STRIP(HOME)) !! "\SASPlatformObjectFramework\9.4\tools\sas-list-objects.exe"" -host 39 ! ""&G_METASERVER."" -port ""&G_METAPORT.""" !! 40 41 " -user ""&G_METAUSER"" -password ""&G_METAPASS"" -domain ""DefaultAuth""" !! 42 " -types ""&LIST_OF_TYPES."" -format csv " !! 43 " > C:\Users\sasdemo\md_ojects_list.csv 2>&1" ; 44 CALL SYSTEM(%str(TASK)); 45 RUN; 46 mend; 47 */ 48 49 DATA test; 50 HOME = %str(SYSGET("SAS_HOME")); 51 ATTRIB TASK FORMAT=$2000.; 52 TASK = catx(' ' 53 ,quote(catx('\',home,'SASPlatformObjectFramework\9.4\tools\sas-list-objects.exe')) 54 ,'-host',quote("&G_METASERVER.") 55 ,'-port',quote("&G_METAPORT.") 56 ,'-user',quote("&G_METAUSER.") 2 The SAS System 17:17 Friday, September 27, 2019 57 ,'-password',quote("&G_METAPASS.") 58 ,'-domain',quote("DefaultAuth") 59 ,'-types',quote("&LIST_OF_TYPES.") 60 ,'-format csv' 61 ,'>',quote('C:\Users\sasdemo\md_ojects_list.csv') 62 ); 63 64 CALL SYSTEM(TASK); 65 RUN; NOTE: The data set WORK.TEST has 1 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 11.47 seconds cpu time 0.01 seconds 66 67 68 GOPTIONS NOACCESSIBLE; 69 %LET _CLIENTTASKLABEL=; 70 %LET _CLIENTPROCESSFLOWNAME=; 71 %LET _CLIENTPROJECTPATH=; 72 %LET _CLIENTPROJECTPATHHOST=; 73 %LET _CLIENTPROJECTNAME=; 74 %LET _SASPROGRAMFILE=; 75 %LET _SASPROGRAMFILEHOST=; 76 77 ;*';*";*/;quit;run; 78 ODS _ALL_ CLOSE; 79 80 81 QUIT; RUN; 82
Looks like it ran. What did it write into the file?
I deleted the file before the run and the file is not created.
Regards,
Christoph
Remove the redirection from the end of the command and try running the command using a pipe instead and see what output it generates. Something like:
data _null_;
command = catx(.......);
infile dummy pipe filevar=command ;
input;
put _infile_;
run;
Thank you for your support
You can use functions to make generating the command a lot easier.
See if that helps.
TASK = catx(' '
,quote(catx('\',home,'SASPlatformObjectFramework\9.4\tools\sas-list-objects.exe'))
,'-host',quote("&G_METASERVER.")
,'-port',quote("&G_METAPORT.")
,'-user',quote("&G_METAUSER.")
,'-password',quote("&G_METAPASS.")
,'-domain',quote("DefaultAuth")
,'-types',quote("&LIST_OF_TYPES.")
,'-format csv'
,'>',quote('C:\Users\sasdemo\md_ojects_list.csv')
);
Thank you Tom.
The command is running with this change, but the output are not in the CSV file.
Regards,
Christoph
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!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.