BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cwl
Fluorite | Level 6 cwl
Fluorite | Level 6

Hi all,

 

 
if I run the following program, then the desired CSV file is not written
 
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
I run SAS9.4M6 on a Windows 10 environment.
 
Any ideas?
 
Regards,
Christoph
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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;

View solution in original post

15 REPLIES 15
Reeza
Super User
Show what TASK looks like using a PUT statement before the call system.
And show us the log please.
cwl
Fluorite | Level 6 cwl
Fluorite | Level 6

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 

cwl
Fluorite | Level 6 cwl
Fluorite | Level 6

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

 

Reeza
Super User
Please post the actual log.
cwl
Fluorite | Level 6 cwl
Fluorite | Level 6

this is the log in German language

 

Der Befehl "C:\Program" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
cwl
Fluorite | Level 6 cwl
Fluorite | Level 6
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         
Tom
Super User Tom
Super User

Looks like it ran.  What did it write into the file?

cwl
Fluorite | Level 6 cwl
Fluorite | Level 6

I deleted the file before the run and the file is not created.

 

Regards,

Christoph

 

 

Tom
Super User Tom
Super User

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;
cwl
Fluorite | Level 6 cwl
Fluorite | Level 6

Thank you for your support

Tom
Super User Tom
Super User

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')
);
cwl
Fluorite | Level 6 cwl
Fluorite | Level 6

Thank you Tom.

 

The command is running with this change, but the output are not in the CSV file.

 

Regards,

Christoph

Reeza
Super User
You have two path references there, are they all on the same server as where you're testing?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 15 replies
  • 1634 views
  • 2 likes
  • 4 in conversation