BookmarkSubscribeRSS Feed
c8826024
Calcite | Level 5
All,

I use PROC REPORT to generate a sales report by region like this:

Date sale cost
6/1/2011 300 200
6/2/2011 400 100
6/3/2011 500 400
6/4/2011 600 200
6/5/2011 150 70
6/6/2011 350 250
M-t-d total 2400 1220
Prior month total 5000 3000

The charllenge is how I can get prior month total in the report. I know I may
use COMPUTE block. Does anybody know how I can do it?
19 REPLIES 19
Cynthia_sas
SAS Super FREQ
Hi:
In order to put an "extra" break line onto your report, to hold the prior month totals, you would need to use an "extra" variable to be a break variable. Assuming that your prior month totals are in a different dataset than the MTD dataset, you would need to figure out what the correct values were -- and then probably create a macro variable from those values and then use the macro variables in a COMPUTE block.

The example program below creates some fake data and then shows the progression of how a PROC REPORT might work...from #1 -- where you use the "extra" breaking variable to put 2 summary lines at the bottom of the report. to #2, where you assign different numbers to the summary line created by the RBREAK AFTER statement. And, finally, to #3, where you use macro variables in your COMPUTE block to change the RBREAK AFTER summary line. In my example, the 2 %LET statements would be replaced by some other code to get the Prior Month totals from the dataset that contains that data -- possibly with PROC SQL or with a DATA step program.

cynthia
[pre]
** make some data -- a few obs for each day;
** also create XTRA variable to get second break line;
** make this variable the same value for every obs.;
data sales;
xtra = 1;
do date='01JUN2011'd to '07JUN2011'd;
sales = ranuni(0) * 500;
cost = sales * .35;
output;
sales = sales + (sales*.13);
cost = sales * .35;
output;
end;
format date mmddyy10.;
run;

ods listing close;
ods html file='c:\temp\mult_break_lines_report.html' style=sasweb;
proc report data=sales nowd;
title '1) Show 2 Break Lines -- initially totals will be same';
column xtra date showdate sales cost;
define xtra / group;
define date / group;
define showdate / computed style(column)={just=r};
define sales /sum f=comma10.2;
define cost / sum f=comma10.2;
break after xtra / summarize;
rbreak after / summarize;
compute showdate / character length=30;
showdate = put(date,mmddyy10.);
if upcase(_break_) = 'XTRA' then
showdate = 'XTRA Break Total';
else if _break_ = '_RBREAK_' then
showdate = '_RBREAK_ Break Total';
endcomp;
run;

proc report data=sales nowd;
title '2) Change Break Line Values with fake numbers';
column xtra date showdate sales cost;
define xtra / group;
define date / group;
define showdate / computed style(column)={just=r};
define sales /sum f=comma10.2;
define cost / sum f=comma10.2;
break after xtra / summarize;
rbreak after / summarize;
compute showdate / character length=30;
showdate = put(date,mmddyy10.);
if upcase(_break_) = 'XTRA' then
showdate = 'XTRA Break Total';
else if _break_ = '_RBREAK_' then
showdate = '_RBREAK_ Break Total';
endcomp;
compute after;
** assign arbitrary numbers to the _RBREAK_ summary line;
sales.sum = 8888.88;
cost.sum = 7777.77;
endcomp;
run;

** Create macro variables with %LET -- or use other ;
** methods to get these numbers;
%let priorsales = 2222.22;
%let priorcost = 1111.11;

proc report data=sales nowd;
title '3) Use Macro Variable Values for _RBREAK_ Line';
column xtra date showdate sales cost;
define xtra / group noprint;
define date / group noprint;
define showdate / computed 'Date'
style(column)={just=r} ;
define sales /sum f=comma10.2 'Sales';
define cost / sum f=comma10.2 'Cost';
break after xtra / summarize;
rbreak after / summarize;
compute showdate / character length=30;
showdate = put(date,mmddyy10.);
if upcase(_break_) = 'XTRA' then
showdate = 'M-T-D Totals';
else if _break_ = '_RBREAK_' then
showdate = 'Prior Month Totals';
endcomp;
compute after;
** use macro variables to provide the correct Prior Month values;
sales.sum = &priorsales;
cost.sum = &priorcost;
endcomp;
run;
ods _all_ close;
title; footnote;
[/pre]
c8826024
Calcite | Level 5
Thanks Cynthia. But my data is far more complicate. My report will be broken up by region. It will be difficult to define the macro variables by different regions.
Cynthia_sas
SAS Super FREQ
Hi:
Using Macro variables is not the ONLY technique -- it was just the one I used to illustrate the data that you posted.

Without knowing the structure of YOUR data, I have made some fake data for 2 regions. Then I made a fake "pastmonths" table with only a few months of summary information. Then using a MERGE, I made a new data file, where the summary info for the previous month was present only on the first observation for each region. This means that the summary in PROC REPORT will have the information from the MERGE available in a COMPUTE block. The PROC REPORT step below is almost exactly like what I previously posted. The bulk of the "new" stuff is the data manipulation/MERGE to get the structure correct. After you understand how PROC REPORT is operating, you can use NOPRINT on the columns for PRIORSALES and PRIORCOST to hide those columns on the final report.

cynthia
[pre]
data sales;
infile datalines dlm = ',' dsd;
input region $ date: mmddyy10. sales cost;
** subtract 1 from month to get prior month for merge;
month = month(date)-1;
year = year(date);
return;
datalines;
"East","06/01/2011",142.53,114.89
"East","06/01/2011",349.52,317.33
"East","06/02/2011",353.39,123.69
"East","06/02/2011",399.33,139.76
"East","06/02/2011",411.45,144.01
"East","06/03/2011",211.94,174.18
"East","06/03/2011",246.76,186.37
"East","06/04/2011",236.43,182.75
"East","06/04/2011",267.17,193.51
"East","06/05/2011",432.65,345.23
"East","06/05/2011",544.74,455.26
"East","06/05/2011",677.76,544.27
"East","06/06/2011",201.28,130.45
"East","06/06/2011",207.40,172.59
"East","06/07/2011",138.40,108.44
"East","06/07/2011",156.39,104.74
"East","06/07/2011",161.14,106.40
"West","06/01/2011",111.53,98.89
"West","06/01/2011",239.52,217.33
"West","06/02/2011",233.39,113.69
"West","06/02/2011",239.33,119.76
"West","06/02/2011",231.45,114.01
"West","06/03/2011",231.94,114.18
"West","06/03/2011",236.76,116.37
"West","06/04/2011",226.43,112.75
"West","06/04/2011",217.17,113.51
"West","06/05/2011",212.65,245.23
"West","06/05/2011",214.74,255.26
"West","06/05/2011",217.76,144.27
"West","06/06/2011",201.28,110.45
"West","06/06/2011",206.40,112.59
"West","06/07/2011",118.40,98.44
"West","06/07/2011",116.39,97.74
"West","06/07/2011",111.14,93.40
;
run;

proc sort data=sales;
by month year region;
run;

data pastmonths;
infile datalines dlm=',' dsd;
input date : mmddyy10. totsales totcost region $;
month = month(date);
year = year(date);
return;
datalines;
03/31/2011,1111.11,1212.12,"East"
04/30/2011,2222.22,2323.23,"East"
05/31/2011,3333.33,3434.34,"East"
03/31/2011,4444.44,4443.43,"West"
04/30/2011,5555.22,5321.23,"West"
05/31/2011,6666.33,6543.34,"West"
;
run;

proc sort data=pastmonths;
by month year region;
run;

data newdata(keep=xtra region date sales cost priorsales priorcost);
merge sales(in=mtd)
pastmonths(in=past);
by month year region;
xtra = catt(region,'XXX');
if mtd and past then do;
if first.region = 1 then do;
priorsales = totsales;
priorcost = totcost;
end;
else do;
priorsales = 0;
priorcost = 0;
end;
output;
end;
run;

ods listing;
proc print data=newdata;
title 'what does new version of data look like';
title2 'Note that prior month info is only on 1st obs for each region';
title3 'So summary using BREAK will be OK in PROC REPORT';
format date mmddyy10.;
run;

ods listing close;
ods html file='c:\temp\mult_break_lines_report4.html' style=sasweb;
proc report data=newdata nowd;
title '4) Use Merged Data Values for _RBREAK_ Line';
column region xtra date showdate priorsales priorcost sales cost;
define region / group 'Region';
define xtra / group noprint;
define date / group noprint;
define showdate / computed 'Date'
style(column)={just=r} ;
define priorsales /sum f=comma10.2 'Prior Sales' /* noprint */;
define priorcost / sum f=comma10.2 'Prior Cost' /* noprint */;
define sales /sum f=comma10.2 'Sales';
define cost / sum f=comma10.2 'Cost';

break after xtra / summarize;
break after region/ summarize;
compute showdate / character length=30;
showdate = put(date,mmddyy10.);
if upcase(_break_) = 'XTRA' then
showdate = 'M-T-D Totals';
else if upcase(_break_) = 'REGION' then
showdate = 'Prior Month Totals';
endcomp;
compute after region;
** use vars from pastmonths data to populate the summary line;
sales.sum = priorsales.sum;
cost.sum = priorcost.sum;
line ' ';
endcomp;
run;
ods _all_ close;
title; footnote;
[/pre]
c8826024
Calcite | Level 5

Cynthia,

That is a really nice solution. The fake dataset you created is very similar to my dataset. I am not very familiar with COMPUTE and BREAK AFTER statement in PROC REPORT. I need to create different reports by different regions. So I use BY statement in PROC REPORT to produce different region report in different EXCEL worksheet. Then I try to twist your BREAK AFTER and COMPUTE AFTER statement. But it does give me the result I am looking for. Do you have any idea?

Thanks again.

Cynthia_sas
SAS Super FREQ

Hi:

  As an alternative to BY group processing, you could remove the BY statement and use PAGE processing (which is unique to PROC REPORT and somewhat similar to the PAGE dimension in TABULATE). You would need to modify the BREAK statement:

break after region / summarize page;

(and, be sure to get rid of the BY statement, too)

  ODS TAGSETS.EXCELXP (which is the destination that creates multiple worksheets automatically), will respect the PAGE that's created for every REGION and will then make a new worksheet for every region. You might also discover that Excel uses a default width for the SHOWDATE column and you might also need to modify or change the cellwidth in the DEFINE statement for SHOWDATE:

define showdate / computed 'Date'

       style(column)={just=r cellwidth=1.5in};

   But I think a combination of the above techniques (using TAGSETS.EXCELXP, using the PAGE option on the BREAK statement and possibly altering the DEFINE statement for SHOWDATE) should work to make 2 sheets (using my data) -- one for EAST and another for WEST.

cynthia

Ksharp
Super User

Maybe you need to process your dataset firstly.

datasales;

  infile datalines dlm = ',' dsd;

  input region $ date : ddmmyy10.sales cost;

  month = month(date);

  format date ddmmyy10.;

datalines;

"East","06/01/2011",142.53,114.89

"East","06/01/2011",349.52,317.33

"East","06/02/2011",353.39,123.69

"East","06/02/2011",399.33,139.76

"East","06/02/2011",411.45,144.01

"East","06/03/2011",211.94,174.18

"East","06/03/2011",246.76,186.37

"East","06/04/2011",236.43,182.75

"East","06/04/2011",267.17,193.51

"West","06/01/2011",142.53,114.89

"West","06/01/2011",349.52,317.33

"West","06/02/2011",353.39,123.69

"West","06/02/2011",399.33,139.76

"West","06/02/2011",411.45,144.01

"West","06/03/2011",211.94,174.18

"West","06/03/2011",246.76,186.37

"West","06/04/2011",236.43,182.75

"West","06/04/2011",267.17,193.51

;

run;

proc means data=sales nway noprint;

class region month;

var sales cost;

output out=want(drop=_:) sum=/autoname;

run;

datawant;

set want;

lag_sales_sum=lag(sales_sum);

lag_cost_sum=lag(cost_sum);

if month eq 1 then call missing(lag_sales_sum ,lag_cost_sum);

run;

datasales;

merge sales want;

by region month;

run;

ods html file='c:\temp\xx.html' style=sasweb;

proc report data=sales nowd out=test;

by region;

column month date sales cost sales_sumcost_sum lag_sales_sum lag_cost_sum;

define month/order noprint;

define date/display;

define sales_sum/display noprint;

define cost_sum/display noprint;

define lag_sales_sum/display noprint;

define lag_cost_sum/display noprint;

compute lag_cost_sum;

if missing(_break_) then do;

_sales_sum=sales_sum;_cost_sum=cost_sum;

_lag_sales_sum=lag_sales_sum; _lag_cost_sum=lag_cost_sum;

end;

endcomp;

compute after month;

  line 'M-t-d' @10 _sales_sum best8. @20 _cost_sum best8.;

  line 'Pri-m-t' @10 _lag_sales_sum best8. @20 _lag_cost_sum best8.;

endcomp;

run;

ods html close;

Ksharp

Cynthia_sas
SAS Super FREQ

Hi:

  While a DATA step pre-processing approach is one possible approach, I don't believe it is necessary. With just 2 changes to my previously posted code, I was able to generate a worksheet for each region using TAGSETS.EXCELXP. The other bump in your approach (to write the extra summary lines with LINE statements) is that  there is a high chance that LINE statement output will not appear correctly because the @10 and @20 really only appear as you intend in the LISTING destination (output window). The ODS HTML approach will result in both regions appearing on one sheet when the file is opened in Excel. Also, you would have to use either ODS HTML3 or ODS MSOFFICE2K in order to have the STYLE=SASWEB respected, since Excel isn't really happy about using the style with ODS HTML 4.0 created HTML tags.

cynthia

Ksharp
Super User

Hi. Cynthia.

I know it is not necessary to process data firstly. But For op's purpose , Using only one proc report  is more difficult than data step.So I prefer to pre-process data for some situation proc report faced difficultly. For @10

it is depend with different destination.Since op did not mention what his destination,and he or she want to use by statement in proc report, so i just want to achieve it by op's purpose.

Ksharp

Cynthia_sas
SAS Super FREQ

Hi,

As I said, pre-processing is a viable alternative.

However, the PAGE approach works just as well as BY group processing -- for the purpose of creating multiple sheets. And, since the OP said the main interest was in multi-sheet workbooks in Excel -- this, to me, pointed to TAGSETS.EXCELXP as the destination -- one of the destinations where the LINE statement with @column positioning would not be respected.

cynthia

c8826024
Calcite | Level 5

Thanks Cynthia.

I use SHEET_INTERVAL='bygroup' options in EXCELXP TAGSET to populate the tables name by region. If I use your solution, it seems that I cannot do it anymore. Do you have other alternative way?

Cynthia_sas
SAS Super FREQ

Hi:

  The default behavior of ODS TAGSETS.EXCELXP is for sheet_interval to be set to 'TABLE' -- when PROC REPORT makes a new table for every page, this default sheet_interval value will make a new sheet for every region's "page"  -- without needing to reset the option. So, essentially, you do not need to use sheet_interval='bygroup' -- especially if you take OUT the BY statement, there would be no BY group for sheet_interval='bygroup' to interface with.

  The code at the bottom of the post is what I used (only the TAGSETS.EXCELXP section is shown)...the rest of the processing and data is the same as previously posted.

cynthia

ods listing close;
ods tagsets.excelxp file='c:\temp\use_break_page5.xls' style=sasweb;
proc report data=newdata nowd;
  title '5) Use Merged Data Values for _RBREAK_ Line';
  column region xtra date showdate priorsales priorcost sales cost;
  define region / group 'Region';
  define xtra / group noprint;
  define date / group noprint;
  define showdate / computed 'Date'
         style(column)={just=r cellwidth=1.5in} ;
  define priorsales /sum f=comma10.2 'Prior Sales' /* noprint */;
  define priorcost / sum f=comma10.2 'Prior Cost' /* noprint */;
  define sales /sum f=comma10.2 'Sales';
  define cost / sum f=comma10.2 'Cost';
                        
  break after xtra / summarize;
  break after region/ summarize page;
  compute showdate / character length=30;
     showdate = put(date,mmddyy10.);
     if upcase(_break_) = 'XTRA' then
        showdate = 'M-T-D Totals';
     else if upcase(_break_) = 'REGION' then
        showdate = 'Prior Month Totals';
  endcomp;
  compute after region;
     ** use vars from pastmonths data to populate the summary line;
     sales.sum = priorsales.sum;
     cost.sum = priorcost.sum;
     line ' ';
  endcomp;
run;
ods _all_ close;
title; footnote;

Ksharp
Super User

There are one more way to use line statement.

As I said, you need to adjust it with the different destionation.

data sales;
  infile datalines dlm = ',' dsd;
  input region $ date : ddmmyy10. sales cost;
  month = month(date);
  format date ddmmyy10.;
datalines;
"East","06/01/2011",142.53,114.89
"East","06/01/2011",349.52,317.33
"East","06/02/2011",353.39,123.69
"East","06/02/2011",399.33,139.76
"East","06/02/2011",411.45,144.01
"East","06/03/2011",211.94,174.18
"East","06/03/2011",246.76,186.37
"East","06/04/2011",236.43,182.75
"East","06/04/2011",267.17,193.51
"West","06/01/2011",142.53,114.89
"West","06/01/2011",349.52,317.33
"West","06/02/2011",353.39,123.69
"West","06/02/2011",399.33,139.76
"West","06/02/2011",411.45,144.01
"West","06/03/2011",211.94,174.18
"West","06/03/2011",246.76,186.37
"West","06/04/2011",236.43,182.75
"West","06/04/2011",267.17,193.51
;
run;

proc means data=sales nway noprint;
class region month;
var sales cost;
output out=want(drop=_:) sum=/autoname;
run;

data want;
set want;
lag_sales_sum=lag(sales_sum);
lag_cost_sum=lag(cost_sum);
if month eq 1 then call missing(lag_sales_sum ,lag_cost_sum);
run;

data sales;
merge sales want;
by region month;
run;

ods tagsets.excelxp file='c:\temp\use_break_page5.xls' 
  options(SHEET_INTERVAL='bygroup')  style=sasweb;

proc report data=sales nowd;
by region;
column month date sales cost sales_sum cost_sum lag_sales_sum lag_cost_sum;
define month/order noprint;
define date/display;
define sales_sum/display noprint;
define cost_sum/display noprint;
define lag_sales_sum/display noprint;
define lag_cost_sum/display noprint;
compute lag_cost_sum;
if missing(_break_) then do;
_sales_sum=sales_sum;_cost_sum=cost_sum;
_lag_sales_sum=lag_sales_sum; _lag_cost_sum=lag_cost_sum;
end;
endcomp;
compute after month;
  str_sum='          '||_sales_sum||'  '||_cost_sum;
  str_lag_sum='      '||_lag_sales_sum||'    '||_lag_cost_sum;
  line @1 'M-t-d:' str_sum $50.;
  line @1 'Pri-m-t:' str_lag_sum $50.;
  line ' ';
  line ' ';
endcomp;

run;

ods tagsets.excelxp close;

OK. I understand what your mean. Maybe your method is a better choice.

Ksharp

c8826024
Calcite | Level 5

Thank you so much. I will try both solution.

c8826024
Calcite | Level 5

Ok, my manager want to change the report template AGAIN. He want to have prior month totle across different region and all region report should be in different worksheet BUT one workbook.

Here is my source data:

proc_mmcountryprocess_dta1a2a7a9a11a_totalb1b2b7b9b11b_totalab_totalrealcoamt
1/1/20121.NA1/1/2012100200300400100010010011001000
1/1/20121.NA1/2/2012100200300400100010110111011000
1/1/20121.NA1/3/2012100200300400100010210211021000
1/1/20121.NA1/4/2012100200300400100010310311031000
1/1/20121.NA1/5/2012100200300400100010410411041000
1/1/20121.NA1/6/2012100200300400100010510511051000
1/1/20121.NA1/7/2012100200300400100010610611061000
1/1/20121.NA1/8/2012100200300400100010710711071000
1/1/20121.NA1/9/2012100200300400100010810811081000
1/1/20121.NA1/10/2012100200300400100010910911091000
1/1/20121.NA1/11/2012100200300400100011011011101000
1/1/20121.NA1/12/2012100200300400100011111111111000
1/1/20121.NA1/13/2012100200300400100011211211121000
1/1/20121.NA1/14/2012100200300400100011311311131000
1/1/20121.NA1/15/2012100200300400100011411411141000
1/1/20121.NA1/16/2012100200300400100011511511151000
1/1/20121.NA1/17/2012100200300400100011611611161000
1/1/20121.NA1/18/2012100200300400100011711711171000
1/1/20121.NA1/19/2012100200300400100011811811181000
1/1/20121.NA1/20/2012100200300400100011911911191000
1/1/20121.NA1/21/2012100200300400100012012011201000
1/1/20121.NA1/22/2012100200300400100012112111211000
1/1/20121.NA1/23/2012100200300400100012212211221000
1/1/20121.NA1/24/2012100200300400100012312311231000
1/1/20121.NA1/25/2012100200300400100012412411241000
1/1/20121.NA1/26/2012100200300400100012512511251000
1/1/20121.NA1/27/2012100200300400100012612611261000
1/1/20121.NA1/28/2012100200300400100012712711271000
1/1/20121.NA1/29/2012100200300400100012812811281000
1/1/20121.NA1/30/2012100200300400100012912911291000
1/1/20121.NA1/31/2012100200300400100013013011301000
1/1/20122.UK1/1/2012100200300400100013113111311000
1/1/20122.UK1/2/2012100200300400100013213211321000
1/1/20122.UK1/3/2012100200300400100013313311331000
1/1/20122.UK1/4/2012100200300400100013413411341000
1/1/20122.UK1/5/2012100200300400100013513511351000
1/1/20122.UK1/6/2012100200300400100013613611361000
1/1/20122.UK1/7/2012100200300400100013713711371000
1/1/20122.UK1/8/2012100200300400100013813811381000
1/1/20122.UK1/9/2012100200300400100013913911391000
1/1/20122.UK1/10/2012100200300400100014014011401000
1/1/20122.UK1/11/2012100200300400100014114111411000
1/1/20122.UK1/12/2012100200300400100014214211421000
1/1/20122.UK1/13/2012100200300400100014314311431000
1/1/20122.UK1/14/2012100200300400100014414411441000
1/1/20122.UK1/15/2012100200300400100014514511451000
1/1/20122.UK1/16/2012100200300400100014614611461000
1/1/20122.UK1/17/2012100200300400100014714711471000
1/1/20122.UK1/18/2012100200300400100014814811481000
1/1/20122.UK1/19/2012100200300400100014914911491000
1/1/20122.UK1/20/2012100200300400100015015011501000
1/1/20122.UK1/21/2012100200300400100015115111511000
1/1/20122.UK1/22/2012100200300400100015215211521000
1/1/20122.UK1/23/2012100200300400100015315311531000
1/1/20122.UK1/24/2012100200300400100015415411541000
1/1/20122.UK1/25/2012100200300400100015515511551000
1/1/20122.UK1/26/2012100200300400100015615611561000
1/1/20122.UK1/27/2012100200300400100015715711571000
1/1/20122.UK1/28/2012100200300400100015815811581000
1/1/20122.UK1/29/2012100200300400100015915911591000
1/1/20122.UK1/30/2012100200300400100016016011601000
1/1/20122.UK1/31/2012100200300400100016116111611000
1/1/20123.DE1/1/2012100200300400100016216211621000
1/1/20123.DE1/2/2012100200300400100016316311631000
1/1/20123.DE1/3/2012100200300400100016416411641000
1/1/20123.DE1/4/2012100200300400100016516511651000
1/1/20123.DE1/5/2012100200300400100016616611661000
1/1/20123.DE1/6/2012100200300400100016716711671000
1/1/20123.DE1/7/2012100200300400100016816811681000
1/1/20123.DE1/8/2012100200300400100016916911691000
1/1/20123.DE1/9/2012100200300400100017017011701000
1/1/20123.DE1/10/2012100200300400100017117111711000
1/1/20123.DE1/11/2012100200300400100017217211721000
1/1/20123.DE1/12/2012100200300400100017317311731000
1/1/20123.DE1/13/2012100200300400100017417411741000
1/1/20123.DE1/14/2012100200300400100017517511751000
1/1/20123.DE1/15/2012100200300400100017617611761000
1/1/20123.DE1/16/2012100200300400100017717711771000
1/1/20123.DE1/17/2012100200300400100017817811781000
1/1/20123.DE1/18/2012100200300400100017917911791000
1/1/20123.DE1/19/2012100200300400100018018011801000
1/1/20123.DE1/20/2012100200300400100018118111811000
1/1/20123.DE1/21/2012100200300400100018218211821000
1/1/20123.DE1/22/2012100200300400100018318311831000
1/1/20123.DE1/23/2012100200300400100018418411841000
1/1/20123.DE1/24/2012100200300400100018518511851000
1/1/20123.DE1/25/2012100200300400100018618611861000
1/1/20123.DE1/26/2012100200300400100018718711871000
1/1/20123.DE1/27/2012100200300400100018818811881000
1/1/20123.DE1/28/2012100200300400100018918911891000
1/1/20123.DE1/29/2012100200300400100019019011901000
1/1/20123.DE1/30/2012100200300400100019119111911000
1/1/20123.DE1/31/2012100200300400100019219211921000
1/1/20128.Global Total1/1/2012300600900012003000003940039433941000
1/1/20128.Global Total1/2/2012300600900012003000003970039733971000
1/1/20128.Global Total1/3/2012300600900012003000004000040034001000
1/1/20128.Global Total1/4/2012300600900012003000004030040334031000
1/1/20128.Global Total1/5/2012300600900012003000004060040634061000
1/1/20128.Global Total1/6/2012300600900012003000004090040934091000
1/1/20128.Global Total1/7/2012300600900012003000004120041234121000
1/1/20128.Global Total1/8/2012300600900012003000004150041534151000
1/1/20128.Global Total1/9/2012300600900012003000004180041834181000
1/1/20128.Global Total1/10/2012300600900012003000004210042134211000
1/1/20128.Global Total1/11/2012300600900012003000004240042434241000
1/1/20128.Global Total1/12/2012300600900012003000004270042734271000
1/1/20128.Global Total1/13/2012300600900012003000004300043034301000
1/1/20128.Global Total1/14/2012300600900012003000004330043334331000
1/1/20128.Global Total1/15/2012300600900012003000004360043634361000
1/1/20128.Global Total1/16/2012300600900012003000004390043934391000
1/1/20128.Global Total1/17/2012300600900012003000004420044234421000
1/1/20128.Global Total1/18/2012300600900012003000004450044534451000
1/1/20128.Global Total1/19/2012300600900012003000004480044834481000
1/1/20128.Global Total1/20/2012300600900012003000004510045134511000
1/1/20128.Global Total1/21/2012300600900012003000004540045434541000
1/1/20128.Global Total1/22/2012300600900012003000004570045734571000
1/1/20128.Global Total1/23/2012300600900012003000004600046034601000
1/1/20128.Global Total1/24/2012300600900012003000004630046334631000
1/1/20128.Global Total1/25/2012300600900012003000004660046634661000
1/1/20128.Global Total1/26/2012300600900012003000004690046934691000
1/1/20128.Global Total1/27/2012300600900012003000004720047234721000
1/1/20128.Global Total1/28/2012300600900012003000004750047534751000
1/1/20128.Global Total1/29/2012300600900012003000004780047834781000
1/1/20128.Global Total1/30/2012300600900012003000004810048134811000
1/1/20128.Global Total1/31/2012300600900012003000004840048434841000
2/1/20121.NA2/1/2012100200300400100022422412241000
2/1/20121.NA2/2/2012100200300400100022522512251000
2/1/20121.NA2/3/2012100200300400100022622612261000
2/1/20121.NA2/4/2012100200300400100022722712271000
2/1/20121.NA2/5/2012100200300400100022822812281000
2/1/20121.NA2/6/2012100200300400100022922912291000
2/1/20121.NA2/7/2012100200300400100023023012301000
2/1/20122.UK2/1/2012100200300400100023123112311000
2/1/20122.UK2/2/2012100200300400100023223212321000
2/1/20122.UK2/3/2012100200300400100023323312331000
2/1/20122.UK2/4/2012100200300400100023423412341000
2/1/20122.UK2/5/2012100200300400100023523512351000
2/1/20122.UK2/6/2012100200300400100023623612361000
2/1/20122.UK2/7/2012100200300400100023723712371000
2/1/20123.DE2/1/2012100200300400100023823812381000
2/1/20123.DE2/2/2012100200300400100023923912391000
2/1/20123.DE2/3/2012100200300400100024024012401000
2/1/20123.DE2/4/2012100200300400100024124112411000
2/1/20123.DE2/5/2012100200300400100024224212421000
2/1/20123.DE2/6/2012100200300400100024324312431000
2/1/20123.DE2/7/2012100200300400100024424412441000
2/1/20128.Global Total2/1/2012300600900018003000006930069336933000
2/1/20128.Global Total2/2/2012300600900018003000006960069636963000
2/1/20128.Global Total2/3/2012300600900018003000006990069936993000
2/1/20128.Global Total2/4/2012300600900018003000007020070237023000
2/1/20128.Global Total2/5/2012300600900018003000007050070537053000
2/1/20128.Global Total2/6/2012300600900018003000007080070837083000
2/1/20128.Global Total2/7/2012300600900018003000007110071137113000

The code provided seems not working. Any idea?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 19 replies
  • 1249 views
  • 0 likes
  • 3 in conversation