Hi guys,
I am running into this tricky scenario, need your help or if you can share your experience if it is just relating a bit to this scenario.
So basically, as shown in the diagram..I have a list of variables namely ContractNo (A1,A2,etc) in the Data Job 1 and I want to push them to the Data Job 2 multiple times in order for for it to produce multiple output files with the file name including the ContractNo at the end.
I know I should use some sort of looping but due to my limited experience and knowledge, I have no idea where to start.
[ I am using Dataflux Data Management Studio 2.4]
Thank you so much in advance.
Hi,
Here's something you can try:
- in your first Data Job, read the lines and count how many you have in an Expression node. User setvar function to save this in a Process Job variable. Write all records to a Worktable.
- use the Global Get/Set node to set an increment counter value to -1
- use the Global Get/Set node to add 1 to this value
- use the If Then node to test if this counter is less than the total number of records
- if yes, read a line from the Worktable and call a Data Job that reads your input file (Contract_%%ContractNo%%.txt) and writes to the output.
- connect this Data Job back to the Global Get/Set node that increments the counter.
I am attaching a zipped version of a test job you can use.
Hope this helps.
Audrey
Hi,
Here's something you can try:
- in your first Data Job, read the lines and count how many you have in an Expression node. User setvar function to save this in a Process Job variable. Write all records to a Worktable.
- use the Global Get/Set node to set an increment counter value to -1
- use the Global Get/Set node to add 1 to this value
- use the If Then node to test if this counter is less than the total number of records
- if yes, read a line from the Worktable and call a Data Job that reads your input file (Contract_%%ContractNo%%.txt) and writes to the output.
- connect this Data Job back to the Global Get/Set node that increments the counter.
I am attaching a zipped version of a test job you can use.
Hope this helps.
Audrey
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.