DATA fsalesP;
INFILE "&dirdata.Flowers_Plus.dat";
INPUT CustID $ @9 SaleDate MMDDYY10. Petunia SnapDragon Marigold;
Month = MONTH(SaleDate);
run;
PROC SORT DATA = fsalesP;
BY Month;
RUN;
TITLE;
PROC PRINT;RUN; 1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 data fsalesP;
74 infile '/folders/myfolders/Flowers_Plus.dat';
75 input CustID $ @9 Date MMDDYY10. Petunia SnapDragon Marigold;
76 Month = MONTH(SaleDate);
77 run;
NOTE: Variable SaleDate is uninitialized.
NOTE: The infile '/folders/myfolders/Flowers_Plus.dat' is:
Filename=/folders/myfolders/Flowers_Plus.dat,
Owner Name=sasdemo,Group Name=sas,
Access Permission=-rw-rw-r--,
Last Modified=09Feb2018:21:01:38,
File Size (bytes)=446
NOTE: 14 records were read from the infile '/folders/myfolders/Flowers_Plus.dat'.
The minimum record length was 30.
The maximum record length was 30.
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
14 at 76:9
NOTE: The data set WORK.FSALESP has 14 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.02 seconds
78
79 proc sort data=fsalesp;
80 by Month;
81 run;
NOTE: There were 14 observations read from the data set WORK.FSALESP.
NOTE: The data set WORK.FSALESP has 14 observations and 7 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
82
83 title;
84 proc print;
85 run;
NOTE: There were 14 observations read from the data set WORK.FSALESP.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.11 seconds
cpu time 0.12 seconds
86
87
88 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
101 Hello evertone,
I ran this code provided by our instructor,
and I did not really understand why there were two missing values for the last two columns,
and what did they mean?
Is there anyone who can help me with this?
Thank you much!
The instructor had a small oversight. The INPUT statement creates DATE (not SaleDate). So the calculation for MONTH should be:
month = month(date);
The instructor had a small oversight. The INPUT statement creates DATE (not SaleDate). So the calculation for MONTH should be:
month = month(date);
Thank you very much!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.