Buongiorno a tutti,
devo creare una colonna che contenga la differenza tra un dato ed il suo precedente, ho provato con "retain" ma non riesco, potete aiutarmi?
Grazie ·
·
Buongiorno,
Usa la funzione DIF.
data Have;
input RET_TOT;
datalines;
154
194
681
186
078
133
522
943
430
733
;
data Want;
set Have;
retain Differenza;
Differenza = dif(RET_TOT);
if Differenza = . then Differenza = 0;
run;
proc print; run;
Buongiorno,
Usa la funzione DIF.
data Have;
input RET_TOT;
datalines;
154
194
681
186
078
133
522
943
430
733
;
data Want;
set Have;
retain Differenza;
Differenza = dif(RET_TOT);
if Differenza = . then Differenza = 0;
run;
proc print; run;
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!
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.