BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Reeza
Super User
I'm going to guess when you pass an address it may contain a comma? Can you verify the values within address?

It would also help if you could show the log, which will show exactly which lines are causing issues.

Set the debugging options below first:

options mprint symbolgen;

You can also add mlogic but I find that one can really make your log big so try those first.
ballardw
Super User

@TylerP8813 wrote:

I have written a program that looks at values in a column from dataset Test that dynamically creates resultant datasets based on the values in the column and the number of records that contain that value. 

 

For instance, the values that could occur in that field would be A, B, C, and D. Five records have "A" in that field, two have "B", three have "C", none have "D". So, when I run the program i get table A with 5 records, table B with two records, table C with 3 records, and no table D. When I run it next quarter, that could change. There could be tables B,C, or D and no A. All of the resulting tables are stored as sas7bdat in there own library.

 

Now, I want to build a functionality that queries the library and applies a report template or two (preferably ODS; some of the values A,B,C, or D may have different requirements for how their report has to look) and creates a report for each of the tables present in the library without having to hardcode the names of the tables (rather than just the 4 in the example, there could possibly be 100 or more tables and the total could change quarter to quarter).

 

 


I suggest that you do not split the data at all. Then there is no worry about missing or data sets that should be removed.

 

The you can sort the data by that variable you are using to split and then use that variable as a BY variable for almost any process.

Example:

proc sort data=sashelp.class out=work.class;
   by age;
run;

proc print data=work.class;
   by age;
   var name sex;
run;

You very likely have a copy of the sashelp.class data set supplied by SAS to work with.

The example has ages from 11 to 16 and generates the name and sex by age with an indicator of the age before the output. If I had an 'updated' version of the data set such that it had ages 10, 13 and 26 only the code automatically only creates output for those ages. Not change needed.

 

The concept of BY group processing is a key element of SAS coding in general.

 

If there are bits of your code that only apply to certain values you can usually use a WHERE clause or data set option such as

 

Where age=14;   Age 14 only processed

Where 12 le age le 15;  age 12, 13, 14 and 15 processed

Where age in (11 13);  age 11 and 13 only processed

 

to filter data as needed.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 16 replies
  • 3167 views
  • 3 likes
  • 4 in conversation