Published on :
Général INCONNU

Sans titre

This code is also available in: Deutsch Español Français
Data Analysis

Type : INCONNU


The code does not consume any external data; it is a macro function definition that operates on scalar parameters.

1 Code Block
DATA STEP
Explanation :
Macro definition. It first extracts the number of decimal places from the format ('digital' variable), generates a string representing the precision unit ('roundto' variable), then generates the SAS code combining ROUND and PUT to return the formatted value.
Copied!
1%macro AHGmyput(var,fmt);
2%local digital roundto;
3%let digital=%scan(&fmt,2,.);
4%let roundto=%substr(0.00000000000000,1,%eval(&digital+1))1;
5put(round(&var,&roundto),&fmt)
6%mend;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.