I will say that I am often too lazy to try to work out all of the says SQL needs to be set up with groups and such try to do any kind of complicated summary.
You did something wrong. If you have 64 datasets then the same name cannot be both numeric and character in all 64 datasets.
If this is a one off problem just craft the code by hand instead of trying to get too complex in doing metadata analysis with code.
Here is the structure you will need. Let's just assume that BDATE is the only problem variable. So in this example any dataset where BDATE is char we add the RENAME= dataset option to rename BDATE to BDATE_CHAR. Then you can also add some code to try to convert the numeric BDATE variables in date strings to store in BDATE_CHAR. Whether that is really what you want to do depends on what type of gibberish you actually have in those fields.
I am not going to retype your dataset names from the photographs you keep pasting (why do people of the trouble of making screen grabs and figuring out how to post them into this forum instead of just copying and pasting the text????) so I will just make up a couple of dataset names to show the pattern.
data want;
length ac_pay 8 acc_sta $62 bdate 8 bdate_char $10 ...... ;
set input.argentina
input.brazil (rename=(bdate=bdate_char))
...
;
bdate_char=coalescec(bdate_char,put(bdate,yymmdd10.));
run;
Use SUM() instead of COUN()
sum(type=1)
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.