The SAS Output Delivery System and reporting techniques

Using the Line Statement with Compute

Occasional Contributor
Posts: 11

Using the Line Statement with Compute

I have the below code. I wish to align the summary count under the correct column using the line statement with compute. Using @ doesnt seem to place the text where I need it to be. What I'm I doing wrong?


Options nodate nobyline pageno=1 PS=100 LS=160;

title1 "VBB Member Achievements for All Dates";    
title2 "RUN DATE: &SYSDATE9.";
title3 "&NoRecord";

proc report data=vbb_process out=vbb_out split='*' missing nowd;
 column incent_plan_effdt incentive_plan_name incentive_component_name last_name first_name subscriber_id
           subscriber_and_sfx relationship_code reward_earndt reward_type reward_amount incent_comp_achieve_earndt
           incent_comp_achieve_createdt elig_ruleset ;
 define incent_plan_effdt / group 'Incentative Plan Eff Dt' width=22;
 define incentive_plan_name / group 'Incentive Plan Name' width=19;
 define incentive_component_name / group 'Incentative Component Name' width=25;
 define last_name / order order=internal 'Last Name' width=9;
 define first_name / order order=data 'First Name' width=10;
 define subscriber_id / order order=data 'Subscriber Id' width=13;
 define subscriber_and_sfx  / order order=data 'Member Id' width=14;   
 define relationship_code / order order=data 'Relationship Code' width=17;
    define reward_earndt / order order=data'Reward Earned Dt' width=16;
 define reward_type / order order=data 'Reward Type' width=11;
 define reward_amount / order order=data 'Reward Amt' width=10 format=dollar5.2;
    define incent_comp_achieve_earndt / order order=data 'Incentative Component*Achievement Earn Dt' width=40;
 define incent_comp_achieve_createdt / order order=data 'Incentative Component*Achievement Created Dt' width=42;
 define elig_ruleset / order order=data 'Eligibility Classification' width=11;
 compute before incentive_plan_name;
  ipname = trim(incentive_plan_name);

    compute before incentive_component_name;

    compute after incentive_component_name;
  line @1 incentive_component_name $30. @40 subcnt 4. @45 memcnt 4.;

 compute after subscriber_id;

 compute after subscriber_and_sfx;
 compute before incent_plan_effdt;
  ipe = incent_plan_effdt;

 compute after incent_plan_effdt;
  line @1 ipname $60. 'Count' subtot 4. memtot 4.;
  line @1 ipe mmddyy10. subtot 4. memtot 4.;
 break after incent_plan_effdt / skip;
 rbreak after / summarize dol;


Sample Output:                                                     SubScriber_Id    Member_ID

                                                                               00000001111    000022222

                                            These are the count:           1                         1                         (what I need)

                                                                                        Theses are the counts:  1  1          (what I'm getting).


Posts: 9,365

Re: Using the Line Statement with Compute

Posted in reply to nupedoc79
Hi: Typically @ controls in the LINE statement cannot be "lined up" in destinations other than the LISTING output destination. Since you did NOT show your full code, I am guessing that you are using PDF or RTF with ODS to make your output?

Basically, the LINE statement writes 1 big cell that spans the whole table in ODS destinations like PDF, RTF and HTML and so the placement underneath specific columns can be hard to manage.

There are other PROC REPORT techniques you can use, for example making a "helper" variable so you can have more than 1 break line.

Also, since you did not post any sample data, no one can run your code. It is not clear to me why you are calculating all the totals on your own, when PROC REPORT will do it for you.

And, some of your options, like SKIP, DOL, WIDTH= are all LISTING only options. So if you ARE writing to the LISTING window, then a LINE statement like
line @1 var1 $60. @56 var2 4. @72 var3 4.;
should work for you. If it doesn't work for you then you are not using the LISTING destination.

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation