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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.