Hello Team,
I need verify if the numbers of rows are increased in months.
This is my table:
DATA want;
INPUT TABLE_NAME $ MONTH NOBS GRUP;
CARDS;
TABLE_A 202101 1234 1
TABLE_A 202102 1235 1
TABLE_A 202103 1236 1
TABLE_A 202104 1237 1
TABLE_A 202105 1238 1
TABLE_A 202106 1239 1
TABLE_A 202107 1230 1
TABLE_B 202101 1000 2
TABLE_B 202102 500 2
TABLE_B 202103 700 2
TABLE_B 202104 300 2
;
RUN;
i need compare the nobs of the first month with next moth
Ex: Compare nobs in Grup 1 - > 202101 with 202102, 202102 with 202103, 202103 with 202104.....
and if the month is less than the next month, status = 'true' else 'false', the first month of the grup can start with "TRUE"
What i need:
Thanks!!
Look at the DIF function for starters.
data want;
set have;
by table_name;
dif = dif(NOBS);
if first.table_name or dif>0 then status="TRUE";
else status="FALSE";
run;
Look at the DIF function for starters.
data want;
set have;
by table_name;
dif = dif(NOBS);
if first.table_name or dif>0 then status="TRUE";
else status="FALSE";
run;
Thank you!
How can i start with "TRUE" for the first month of the ids? i can not compare the first one.
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.