BookmarkSubscribeRSS Feed
Selcuk
Calcite | Level 5

I try to connect remote session via rsubmit and I need to pass a parameter to remote session using %syslput. But I have to do it in a macro.

So I have read a problem note in support SAS (http://support.sas.com/kb/47/072.html) , it recommends to use %nrstr expression. But when I use

%nrstr I get a message like

ERROR 180-322: Statement is not valid or it is used out of proper order.

macro >>>

%macro master_test(papa);

  %put ########### Construction type is &papa ###########;

  libname consdata '.....\CONSTRUCTION_DATA';

  options autosignon=yes sascmd='sas -nosyntaxcheck -autoexec "C:\......\autoexec.sas"';

  %NRSTR(%syslput _global_/like='papa' remote=EXTRCTN);

  rsubmit  process=EXTRCTN wait=yes persist=no;

  options autosignon=yes notes sascmd='sas -nosyntaxcheck -autoexec "C:\........\autoexec_for_MASTER.sas"';

  %let e_construction_type=&papa;

  %NRSTR(%syslput _global_/like='e_construction_type' remote=EUSD);

       rsubmit  process=EUSD wait=no persist=no ;

           data a;

                 a=45;  

            run;

       endrsubmit;

  waitfor _all_ EUSD;

  endrsubmit;

%mend;

Best Regards

28 REPLIES 28
Quentin
Super User

Hi,

I haven't used SAS/Connect in many years, so these are mostly guesses.

If you take the code out of the macro, does it work?  (I'm hoping the answer is no)

I noticed a line in the docs for %syslput:

"To use %SYSLPUT, you must have initiated a link between a local SAS session or client and a remote SAS session or server using the SIGNON command or SIGNON statement. For more information, see the documentation for SAS/CONNECT software."

I see you have the autosignon option, which is honored by the rsubmit statement.  Maybe %syslput can't honor the autosignon, so it doesn't know there is a remote session to write to.

--Q.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
Selcuk
Calcite | Level 5

Unfortunately it works out of the macro block

Quentin
Super User

Another wild guess would be to %unqoute it:

 %unquote(%NRSTR(%syslput _global_/like='papa' remote=EXTRCTN));


BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
Selcuk
Calcite | Level 5

Hi Quentin,

thanx for your reply , I hoped that your recommendation would be useful but it didn't... Below the code and you can see the error log on the bottom.

%macro master_test(papa);

  options autosignon=yes sascmd='sas -nosyntaxcheck -autoexec "C:\....\autoexec_for_MASTER.sas"';

  %unquote(%NRSTR(%syslput _global_/like='papa' remote=EXTRCTN));

  rsubmit  process=EXTRCTN wait=yes persist=no;

  options autosignon=yes notes sascmd='sas -nosyntaxcheck -autoexec "C:\....\autoexec_for_MASTER.sas"';

  %let e_construction_type=&papa;

  %unquote(%NRSTR(%syslput _global_/like='e_construction_type' remote=EUSD));

  rsubmit  process=EUSD wait=no persist=no;

       data a;

            a=&e_construction_type;

       run;

  endrsubmit;

  waitfor _all_ EUSD;

  endrsubmit;

%mend;

NOTE: Remote signon to EXTRCTN commencing (SAS Release 9.03.01M1P110211).

NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.

NOTE: All profile changes will be lost at the end of the session.

NOTE: Copyright (c) 2002-2010 by SAS Institute Inc., Cary, NC, USA.

NOTE: SAS (r) Proprietary Software 9.3 (TS1M1)

      Licensed to ############., Site ########.

NOTE: This session is executing on the X64_S08R2  platform.

NOTE: Updated analytical products:

SAS/STAT 9.3_M1

NOTE: SAS initialization used:

      real time           0.09 seconds

      cpu time            0.10 seconds

NOTE: AUTOEXEC processing beginning; file is C:\..........................\autoexec_for_MASTER.sas.

NOTE: PROCEDURE PRINTTO used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

NOTE: AUTOEXEC processing completed.

NOTE: Remote signon to EXTRCTN complete.

NOTE: Remote submit to EXTRCTN commencing.

1     options autosignon=yes notes sascmd='sas -nosyntaxcheck -autoexec "C:\.................\autoexec_for_MASTER.sas"';

2     %unquote(%syslput _global_/like='e_construction_type' remote=EUSD);

ERROR: Unrecognized option to the %SYSLPUT statement.

3     rsubmit process=EUSD wait=no persist=no;

4     data a;

5     a=&e_construction_type;

WARNING: Apparent symbolic reference E_CONSTRUCTION_TYPE not resolved.

6     run;

7     endrsubmit;

8     waitfor _all_ EUSD;

NOTE: Remote submit to EXTRCTN complete.

NOTE: Remote signoff from EXTRCTN commencing.

NOTE: Remote signon to EUSD commencing (SAS Release 9.03.01M1P110211).

NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.

NOTE: All profile changes will be lost at the end of the session.

NOTE: Copyright (c) 2002-2010 by SAS Institute Inc., Cary, NC, USA.

NOTE: SAS (r) Proprietary Software 9.3 (TS1M1)

      Licensed to #########, Site ###########.

NOTE: This session is executing on the X64_S08R2  platform.

NOTE: Updated analytical products:

SAS/STAT 9.3_M1

NOTE: SAS initialization used:

      real time           0.07 seconds

      cpu time            0.07 seconds

NOTE: AUTOEXEC processing beginning; file is C:\................\autoexec_for_MASTER.sas.

NOTE: PROCEDURE PRINTTO used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

NOTE: AUTOEXEC processing completed.

NOTE: Remote signon to EUSD complete.

NOTE: Background remote submit to EUSD in progress.

NOTE: Remote submit to EUSD commencing.

1     data a;

2     a=&e_construction_type;

        -

        22

WARNING: Apparent symbolic reference E_CONSTRUCTION_TYPE not resolved.

ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, INPUT, PUT.

3     run;

NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.A may be incomplete.  When this step was stopped there were 0 observations and 2 variables.

NOTE: DATA statement used (Total process time):

      real time           0.01 seconds

      cpu time            0.00 seconds

NOTE: Remote submit to EUSD complete.

NOTE: Remote signoff from EUSD commencing.

NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414

NOTE: The SAS System used:

      real time           0.41 seconds

      cpu time            0.21 seconds

NOTE: Remote signoff from EUSD complete.

NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414

NOTE: The SAS System used:

      real time           1.00 seconds

      cpu time            0.26 seconds

NOTE: Remote signoff from EXTRCTN complete.

RichardinOz
Quartz | Level 8

It looks to me like you have a 'race condition', ie statements are being executed out of order with respect to which remote session you wish to connect to:

NOTE: Remote submit to EXTRCTN commencing.

1     options autosignon=yes notes sascmd='sas -nosyntaxcheck -autoexec "C:\.................\autoexec_for_MASTER.sas"';

2     %unquote(%syslput _global_/like='e_construction_type' remote=EUSD);

ERROR: Unrecognized option to the %SYSLPUT statement.

System has connected to EXTRCTN but not yet to EUSD hence the option remote=EUSD is not recognised.

You may need to rearrange the macro to have explicit signons to each remote before using %syslput.

Selcuk
Calcite | Level 5

Hi ,

I think that problem isn't that. Because same code works fine when it is not contained by %macro %mend block.

Another point is within the macro block SAS start to read lines as a macro but when it see the %SYSLPUT expression it starts to execute the code immediately.

But still if you can give me a sample using explicit signon I try with pleasure

Best Regards.

RichardinOz
Quartz | Level 8

It seems clear to me from the log that the connection to EXTRCTN happens relatively quickly but the

connection to EUSD takes longer.  The first %syslput statement appears to have executed successfully.

Meanwhile the second %sylput statement (with remote=EUSD) appears to have been executed locally before the connection was complete.  I think you need some statement to force the connection before the %syslput is executed.

I don't have access to a SAS environment with multiple remote sessions so this is my best guess: place dummy rsubmit statements before %syslput commands.

%macro master_test(papa);

  options autosignon=yes sascmd='sas -nosyntaxcheck -autoexec "C:\....\autoexec_for_MASTER.sas"';

  rsubmit  process=EXTRCTN wait=yes ;

  endrsubmit ;

  %unquote(%NRSTR(%syslput _global_/like='papa' remote=EXTRCTN));

  options autosignon=yes notes sascmd='sas -nosyntaxcheck -autoexec "C:\....\autoexec_for_MASTER.sas"';

  %let e_construction_type=&papa;

  rsubmit  process=EUSD wait=yes ;

  endrsubmit ;

  %unquote(%NRSTR(%syslput _global_/like='e_construction_type' remote=EUSD));

  rsubmit  process=EUSD wait=no persist=no;

       data a;

            a=&e_construction_type;

       run;

  endrsubmit;

  waitfor _all_ EUSD;

  endrsubmit;

%mend;

AhmedAl_Attar
Rhodochrosite | Level 12

Hi,

Please double check and look-up examples from either the on-line help, or the SAS/Connect User Guide.

You can use %SYSLPUT on it's own. You don't need to wrap it inside %NRSTR!

I have always used it like this

%syslput <remote macro variable name>  = [some value | &<local macro variable name>] /remote=<Remote host Name>;

Hope this helps,

Ahmed

Selcuk
Calcite | Level 5

Hi Ahmed ,

problem isn't %syslput , it works fine , but if you use it in a macro block you will encounter this problem.

Check this out >>> http://support.sas.com/kb/47/072.html

Best Regards

Tom
Super User Tom
Super User

Where did you define the macro variable as GLOBAL?  The first reference I see to e_construction_type is inside the macro definition.

Try this sample program.

%macro test;

  %local mvar;

  %let mvar=local value;

  %syslput _global_ /like='mvar' ;

%mend test;

%let mvar=global value;

%test;

rsubmit;

  %put mvar="&mvar";

endrsubmit;

Selcuk
Calcite | Level 5

Hi Tom ,

I have to use %syslput in macro block , like below.

%macro test;

  %let mvar=5;

  %syslput _global_ /like='mvar' ;

       rsubmit;

            %put mvar="&mvar";    

       endrsubmit;

%mend test;

%test;

Best Regards

Tom
Super User Tom
Super User

Still looks like you are trying to use SYSLPUT to copy the value of GLOBAL macro variable.  The only definition of MVAR is within the macro TEST so it will not by in the GLOBAL symbol table.  Try adding a %GLOBAL MVAR; statement before the %LET statement in your test macro.

Selcuk
Calcite | Level 5

When I use %global get the error message below

ERROR: Attempt to %GLOBAL a name (PAPA) which exists in a local environment.

Selcuk
Calcite | Level 5

Actualy my problem is that I cant mask %syslput expression from normal execution. I have to execute %syslput expression in macro execution period. The note about this issue in SAS support says to use %NRSTR , but it doesnt work.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 28 replies
  • 4590 views
  • 0 likes
  • 6 in conversation