Subscribe Bookmark RSS Feed

Using global variables in SAS Submit statement

lpaz

Community Trekker

Joined:

Jun 23, 2011

Is it possible to use a global variable while submitting to SAS? I wanted to get user input through a dialogue box and use those inputs to get data from a server with SAS data, something like this:

New Window( "GET DATA",
<V List Box(
Text Box("Enter YRQ"),
YRQ = Number Edit Box( 101 ),
Button Box( "OK"),
Button Box( "Cancel")
));

dyrq = yrq << get; <-- This is what I want to pass to SAS

sasconn = sas connect ("research", 5821);
sasconn << SAS Submit ("
%let yrq = ::dyrq <-- here's where I want to read the global in.
");
Is this possible? Or alternately, is there another way to do this (Note - I'm actually collecting other JSL relevent input in the modal box as well)

Message was edited by: LPaz
3 REPLIES
mattf

Community Trekker

Joined:

Jun 23, 2011

Hi:

Here is one way - build a string which is then submitted to SAS - I am sure there are others.

Best regards,

-Matt

<!

nw = New Window( "GET DATA",

     <<Modal,

     V List Box(

     Text Box("Enter YRQ"),

     YRQ = Number Edit Box( 101 ),

     Button Box( "OK"),

     Button Box( "Cancel")

));

dyrq = yrq << get; //<-- This is what I want to pass to SAS

sasconn = sas connect();     // local PC SAS;

saspgm = Eval Insert("\[        

     %let yrq = ^dyrq^;      * insert value of JMP variable;

     %put *** yrq=&yrq.;

   

]\");

print(saspgm);

rc = SAS Submit( saspgm,

     GetSASLog(True)

);

->

lpaz

Community Trekker

Joined:

Jun 23, 2011

Success!  Thanks so much.

jschroedl

Staff

Joined:

Jun 23, 2011

MattF's technique will work, but the DeclareMacros option does exactly what you're after and should save you a lot of messy code.

Try this:

. . .elided. . .

dyrq = yrq << get;

sasconn = sas connect("research",5821);

sasconn << Submit("data temp; x=&dyrq; proc print; run;", DeclareMacros( dyrq ) );

John