<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: HOW TO: Assign a column value to a global variable in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44539#M394</link>
    <description>This is the workflow:&lt;BR /&gt;
&lt;BR /&gt;
Job1: Retrieve the SEQUENCE NEXTVAL from Oracle&lt;BR /&gt;
Job2:Process data using the NEXTVAL value&lt;BR /&gt;
Job3: Process data using the NEXTVAL value&lt;BR /&gt;
Job4: call Job1 then LOOP Job2 &amp;amp; Job3 END LOOP&lt;BR /&gt;
&lt;BR /&gt;
What I intend to do is to retrieve the NEXTVAL in Job1 and pass to global variable g_logid&lt;BR /&gt;
and then use the &amp;amp;g_logid in the expression section of TABLELOADER throughout.&lt;BR /&gt;
&lt;BR /&gt;
Thnaks,&lt;BR /&gt;
&lt;BR /&gt;
Misbah.</description>
    <pubDate>Tue, 19 Apr 2011 13:46:02 GMT</pubDate>
    <dc:creator>Halaku</dc:creator>
    <dc:date>2011-04-19T13:46:02Z</dc:date>
    <item>
      <title>HOW TO: Assign a column value to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44535#M390</link>
      <description>I have a work flow composed of 4 nested jobs.&lt;BR /&gt;
In one of the jobs I am retrieving Oracle SEQUENCE NEXTVAL and insert into a table. However I need to carry the same value through out the entire work flow and carry it over to other jobs for processing. I know how to assign a global variable to a column value using EXPRESSION in the mapping but I need to do the reverse here in this case. I tried a code in post code but that advances the SEQUENCE value to its next value and that is not acceptable.&lt;BR /&gt;
&lt;BR /&gt;
I'll appreciate suggestions and solutions.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MI</description>
      <pubDate>Tue, 05 Apr 2011 19:08:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44535#M390</guid>
      <dc:creator>Halaku</dc:creator>
      <dc:date>2011-04-05T19:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO: Assign a column value to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44536#M391</link>
      <description>MI,&lt;BR /&gt;
&lt;BR /&gt;
I don't know all the details of what you're trying to do, but if this value needs to be passed between jobs, your best bet is to write it to a table or file.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Tim Stearn</description>
      <pubDate>Fri, 08 Apr 2011 13:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44536#M391</guid>
      <dc:creator>TimStearn_SASProductManagement_</dc:creator>
      <dc:date>2011-04-08T13:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO: Assign a column value to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44537#M392</link>
      <description>Thanks Tim, &lt;BR /&gt;
But I am wondering if I can assign to global variable whose value I am passing in the inner jobs. And what makes you suggest temp table option, is global variable use is not stable in SAS?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for taking time to reply.&lt;BR /&gt;
&lt;BR /&gt;
Misbah.</description>
      <pubDate>Mon, 11 Apr 2011 18:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44537#M392</guid>
      <dc:creator>Halaku</dc:creator>
      <dc:date>2011-04-11T18:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO: Assign a column value to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44538#M393</link>
      <description>Please try more exactly describe your job.&lt;BR /&gt;
You have an outer job, with four inner jobs, right?&lt;BR /&gt;
Are they run in sequence or in parallel (using the loop transform)?&lt;BR /&gt;
Is it in the first job that you retrieve this value?&lt;BR /&gt;
Does the rest of the jobs use tha same value, or does all jobs need to regenerate it (for next job)?&lt;BR /&gt;
You said about writing to a table "and that is not acceptable". Why is that?&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Wed, 13 Apr 2011 13:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44538#M393</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2011-04-13T13:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO: Assign a column value to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44539#M394</link>
      <description>This is the workflow:&lt;BR /&gt;
&lt;BR /&gt;
Job1: Retrieve the SEQUENCE NEXTVAL from Oracle&lt;BR /&gt;
Job2:Process data using the NEXTVAL value&lt;BR /&gt;
Job3: Process data using the NEXTVAL value&lt;BR /&gt;
Job4: call Job1 then LOOP Job2 &amp;amp; Job3 END LOOP&lt;BR /&gt;
&lt;BR /&gt;
What I intend to do is to retrieve the NEXTVAL in Job1 and pass to global variable g_logid&lt;BR /&gt;
and then use the &amp;amp;g_logid in the expression section of TABLELOADER throughout.&lt;BR /&gt;
&lt;BR /&gt;
Thnaks,&lt;BR /&gt;
&lt;BR /&gt;
Misbah.</description>
      <pubDate>Tue, 19 Apr 2011 13:46:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44539#M394</guid>
      <dc:creator>Halaku</dc:creator>
      <dc:date>2011-04-19T13:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO: Assign a column value to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44540#M395</link>
      <description>Are you using Loop for actual looping, or just a way of nesting jobs?&lt;BR /&gt;
If the later, you could just nest job without the Loop transform (if you are in DIS 4.X). In this scenario, there are no SAS/CONNECT remote sessions launched, just expanded code in a single SAS session, which means that global macro variables are available in each job.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Wed, 20 Apr 2011 08:04:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44540#M395</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2011-04-20T08:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO: Assign a column value to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44541#M396</link>
      <description>I agree with Linus: If you're calling job2 &amp;amp; job3 only once then just add them to the flow of job1 without a loop transformation.&lt;BR /&gt;
This way you basically create one big job which executes in a single workspace. So whatever you define in job1 will be available for the included jobs (job2 &amp;amp; job3).&lt;BR /&gt;
You might want to set "source2" option as well.&lt;BR /&gt;
&lt;BR /&gt;
If you have to loop - meaning running job2 &amp;amp; job3 several times with different parameters - then you would need a loop transformation. You possibly would create a control table (one row per parameter value) as input for the loop transformation, under parameter mapping you would assign this control table field to a macro variable, and you would have to parameterize job2 &amp;amp; job3 (done via a hidden prompt which uses the macro variable defined in the loop transformation).

Message was edited by: Patrick</description>
      <pubDate>Sun, 24 Apr 2011 06:24:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44541#M396</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-04-24T06:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO: Assign a column value to a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44542#M397</link>
      <description>Have you tried CURRVAL? it returns the current value of a sequence. here is an example. &lt;BR /&gt;
&lt;BR /&gt;
create sequence seq_customers; &lt;BR /&gt;
&lt;BR /&gt;
select seq_customers.nextval from dual;&lt;BR /&gt;
NEXTVAL                &lt;BR /&gt;
---------------------- &lt;BR /&gt;
2        &lt;BR /&gt;
select seq_customers.currval from dual;&lt;BR /&gt;
CURRVAL                &lt;BR /&gt;
---------------------- &lt;BR /&gt;
2</description>
      <pubDate>Mon, 25 Apr 2011 14:06:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HOW-TO-Assign-a-column-value-to-a-global-variable/m-p/44542#M397</guid>
      <dc:creator>Michael_SAS</dc:creator>
      <dc:date>2011-04-25T14:06:29Z</dc:date>
    </item>
  </channel>
</rss>

