Hello Beautiful People!
I have a simple SAS program that's producing blanks when I run it. The program is below (my intention is for the program to produce what the datalines statement shows):
data work.example_2012;
infile datalines dsd;
input
Month monyy6.
Sales: dollars.;
format month monyy. Sales dollars4.2;
;
datalines;
12-Jan $1,000.00
12-Feb $2,000.00
12-Mar $3,000.00
12-Apr $4,000.00
12-May $5,000.00
12-Jun $6,000.00
12-Jul $7,000.00
12-Aug $8,000.00
12-Sep $9,000.00
12-Oct $10,000.00
12-Nov $11,000.00
12-Dec $12,000.00
;
run;
And the output is like so:
Month Sales
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
Can someone tell me what I'm doing wrong? Any guidance is greatly appreciated!
-Valentine
HI @davidvalentine If you are not really picky, plz read as char and not bother with informat and format
data work.example_2012;
infile datalines ;
input
month $
Sales: dollar10.;
format Sales dollar10.2;
;
datalines;
12-Jan $1,000.00
12-Feb $2,000.00
12-Mar $3,000.00
12-Apr $4,000.00
12-May $5,000.00
12-Jun $6,000.00
12-Jul $7,000.00
12-Aug $8,000.00
12-Sep $9,000.00
12-Oct $10,000.00
12-Nov $11,000.00
12-Dec $12,000.00
;
run;
What date do your want 12-feb to resolve to? 12 feb 2020? 2019?
Hi draycut,
I'd like the date to come out to the following format: "12-Jan" although I'm not picky about it as much as I need the Sales to be $xxxx.xx
HI @davidvalentine If you are not really picky, plz read as char and not bother with informat and format
data work.example_2012;
infile datalines ;
input
month $
Sales: dollar10.;
format Sales dollar10.2;
;
datalines;
12-Jan $1,000.00
12-Feb $2,000.00
12-Mar $3,000.00
12-Apr $4,000.00
12-May $5,000.00
12-Jun $6,000.00
12-Jul $7,000.00
12-Aug $8,000.00
12-Sep $9,000.00
12-Oct $10,000.00
12-Nov $11,000.00
12-Dec $12,000.00
;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.