Data is created directly within the script using the `cards;` statement in DATA steps.
1 Code Block
DATA STEP Data
Explanation : This DATA block creates the `mycur` dataset. The `price` variable is defined with the `dollar8.` informat and format to read and display monetary values in US dollars. The value `$1000000` is provided directly in the script via the `cards;` statement.
Copied!
data mycur;
informat price dollar8.;
format price dollar8.;
input price;
cards;
$1000000
;
run;
1
DATA mycur;
2
informat price dollar8.;
3
FORMAT price dollar8.;
4
INPUT price;
5
CARDS;
6
$1000000
7
;
8
RUN;
2 Code Block
PROC PRINT
Explanation : This PROC PRINT displays the contents of the `mycur` dataset as it was created and formatted in dollars in the previous block.
Copied!
proc print data=mycur;
run;
1
PROC PRINTDATA=mycur;
2
RUN;
3 Code Block
DATA STEP Data
Explanation : This DATA block recreates the `mycur` dataset, replacing the previous version. It uses the `nlmnleur15.2` informat and format, which is suitable for reading and displaying monetary values in euros. The new value `€1000000` is inserted via `cards;`.
Copied!
data mycur;
informat price nlmnleur15.2;
format price nlmnleur15.2;
input price;
cards;
€1000000
;
run;
1
DATA mycur;
2
informat price nlmnleur15.2;
3
FORMAT price nlmnleur15.2;
4
INPUT price;
5
CARDS;
6
€1000000
7
;
8
RUN;
4 Code Block
PROC PRINT
Explanation : This PROC PRINT displays the updated content of the `mycur` dataset, showing the new `price` value formatted in euros.
Copied!
proc print data=mycur;
run;
1
PROC PRINTDATA=mycur;
2
RUN;
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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.