After making the adjustments to fit my actual datasets, the code ran without problem, but when i look at the 'collections' table i get the initial record which is blank except for number_of_rows = 1
and the second record which is the information of my last data set (20110430).
I can't seem to figure out why it is not outputting the datasets in between..
I should have 7 datasets in there, from 20101031 to 20110430.
Thanks again for your replies.
I've triple checked the code, and still now sure why it only outputs the first and last record
it will add new entries, and only the latest
That seemed to be the intention - going forward - Add only for new rows.
Once the initial load of history is complete, the routine I offered would be appropriate.
Perhaps instead of loading the initial row of Collections with just that 1, I should have offered code to load the existing history, a bit like:
proc sql ; create table collect_history as
select memname as data_set_name, nobs as number_of_rows
, scan( memname,-1, '_' ) as date_received
from dictionary.tables
where libname='SRC'
and memname like 'INDICATORS_2%'
order by memname
;
quit ;
* build "proper" collection ;
data collection ;
oldone = number_of_rows ;
set collect_history ;
format pct_change percent8.1 ;
pct_change = ifn( oldone > 0, number_of_rows/ oldone -1, . ) ;
drop oldone ;
run ;
peterC
(discovering the "investment" needed for "improvements" still to be discovered in the Forum - I might have to start a thread seeking some explanations! )
Thank you for your help! This solution worked perfectly.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.