proc transpose data=sasuser.ctargets
out=work.ctarget2
name=Month
prefix=Ctarget;
by year;
run;
Obs
|
Year
|
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
---|---|---|---|---|---|---|---|
1
|
1997
|
192284420
|
86376721
|
28526103
|
260386468
|
109975326
|
102833104
|
2
|
1998
|
108645734
|
147656369
|
202158055
|
41160707
|
264294440
|
267135485
|
3
|
1999
|
85730444
|
74168740
|
39955768
|
312654811
|
318149340
|
187270927
|
Obs
|
Year
|
Month
|
Ctarget1
|
---|---|---|---|
1
|
1997
|
Jan
|
192284420
|
2
|
1997
|
Feb
|
86376721
|
3
|
1997
|
Mar
|
28526103
|
4
|
1997
|
Apr
|
260386468
|
5
|
1997
|
May
|
109975326
|
6
|
1997
|
Jun
|
102833104
|
7
|
1997
|
Jul
|
196728648
|
8
|
1997
|
Aug
|
236996122
|
9
|
1997
|
Sep
|
112413744
|
10
|
1997
|
Oct
|
125401565
|
11
|
1997
|
Nov
|
72551855
|
12
|
1997
|
Dec
|
136042505
|
proc sort data=work.ctarget2;
by year month;
run;
Notice that in the sorted version of Work.Ctarget2,
the values of month are sorted alphabetically within year.
Obs
|
Year
|
Month
|
Ctarget1
|
---|---|---|---|
1
|
1997
|
Apr
|
260386468
|
2
|
1997
|
Aug
|
236996122
|
3
|
1997
|
Dec
|
136042505
|
4
|
1997
|
Feb
|
86376721
|
5
|
1997
|
Jan
|
192284420
|
6
|
1997
|
Jul
|
196728648
|
7
|
1997
|
Jun
|
102833104
|
8
|
1997
|
Mar
|
28526103
|
9
|
1997
|
May
|
109975326
|
10
|
1997
|
Nov
|
72551855
|
11
|
1997
|
Oct
|
125401565
|
12
|
1997
|
Sep
|
112413744
|
Obs
|
SaleMon
|
RevCargo
|
MonthNo
|
---|---|---|---|
1
|
JAN1997
|
$171,520,869.10
|
1
|
2
|
JAN1998
|
$238,786,807.60
|
1
|
3
|
JAN1999
|
$280,350,393.00
|
1
|
4
|
FEB1997
|
$177,671,530.40
|
2
|
5
|
FEB1998
|
$215,959,695.50
|
2
|
data work.mnthsum2; set sasuser.monthsum(keep=SaleMon RevCargo); length Month $ 3; Year=input(substr(SaleMon,4),4.); Month=propcase(SaleMon); run;
Obs
|
SaleMon
|
RevCargo
|
Month
|
Year
|
---|---|---|---|---|
1
|
JAN1997
|
$171,520,869.10
|
Jan
|
1997
|
2
|
JAN1998
|
$238,786,807.60
|
Jan
|
1998
|
3
|
JAN1999
|
$280,350,393.00
|
Jan
|
1999
|
4
|
FEB1997
|
$177,671,530.40
|
Feb
|
1997
|
5
|
FEB1998
|
$215,959,695.50
|
Feb
|
1998
|
6
|
FEB1999
|
$253,999,924.00
|
Feb
|
1999
|
proc sort data=work.mnthsum2;
by year month;
run;
Obs
|
SaleMon
|
RevCargo
|
Month
|
Year
|
---|---|---|---|---|
1
|
APR1997
|
$380,804,120.20
|
Apr
|
1997
|
2
|
AUG1997
|
$196,639,501.10
|
Aug
|
1997
|
3
|
DEC1997
|
$196,504,413.00
|
Dec
|
1997
|
4
|
FEB1997
|
$177,671,530.40
|
Feb
|
1997
|
5
|
JAN1997
|
$171,520,869.10
|
Jan
|
1997
|
6
|
JUL1997
|
$197,163,278.20
|
Jul
|
1997
|
7
|
JUN1997
|
$190,560,828.50
|
Jun
|
1997
|
8
|
MAR1997
|
$196,591,378.20
|
Mar
|
1997
|
9
|
MAY1997
|
$196,261,573.20
|
May
|
1997
|
10
|
NOV1997
|
$190,228,066.70
|
Nov
|
1997
|
11
|
OCT1997
|
$196,957,153.40
|
Oct
|
1997
|
12
|
SEP1997
|
$190,535,012.50
|
Sep
|
1997
|
data work.merged; merge work.mnthsum2 work.ctarget2; by year month; run;
Obs
|
SaleMon
|
RevCargo
|
Month
|
Year
|
---|---|---|---|---|
1
|
APR1997
|
$380,804,120.20
|
Apr
|
1997
|
2
|
AUG1997
|
$196,639,501.10
|
Aug
|
1997
|
3
|
DEC1997
|
$196,504,413.00
|
Dec
|
1997
|
4
|
FEB1997
|
$177,671,530.40
|
Feb
|
1997
|
5
|
JAN1997
|
$171,520,869.10
|
Jan
|
1997
|
Obs
|
Year
|
Month
|
Ctarget1
|
---|---|---|---|
1
|
1997
|
Apr
|
260386468
|
2
|
1997
|
Aug
|
236996122
|
3
|
1997
|
Dec
|
136042505
|
4
|
1997
|
Feb
|
86376721
|
5
|
1997
|
Jan
|
192284420
|