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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.