BookmarkSubscribeRSS Feed
nupedoc79
Fluorite | Level 6

Given the below code specifically the Compute Last_Name logic [see purple code], my questions are why are the lines highed in RED repeating with just the last name value on the line, 2) why would there be a line which appears to be a break line printing populating the last_name field when there's no Compute Afer Last_Name block? Report #1 is what is happening. Report #2 is what I would like to happen. I truly would appreciate any assistance in clearing this up.

 

Thank your very murch in advance....

 

proc report data=vbb_rpt out=vbb_out split='*' missing nowd
            style(header)={tagattr="wrap:YES"}
            style(lines)={tagattr='Format:@'};
    
 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 eff_cnt ;
    
 define incent_plan_effdt / group 'Incentive*Plan*Eff Dt' width=9;
 define incentive_plan_name / group 'Incentive*Plan*Name' width=9 style(column)={tagattr="wrap:YES"};
 define incentive_component_name / group 'Incentive*Component*Name' width=9 style(column)={tagattr="wrap:YES"};;  
    define last_name / order  order=formatted 'Last*Name' width=5;
 define first_name / order order=formatted 'First*Name' width=5;
    define subscriber_id / group 'Subscriber*Id' width=9;
 define subscriber_and_sfx  / group 'Member*Id' width=9;
    define relationship_code / order order=formatted 'Relationship*Code' width=11;
    define reward_earndt / order order=formatted 'Reward*Earned Dt' width=9;
 define reward_type / order order=formatted 'Reward*Type' width=6;
 define reward_amount / order order=formatted 'Reward*Amt' width=6 format=dollar5.2;
    define incent_comp_achieve_earndt / order order=formatted 'Incentive*Component*Achievement*Earn Dt' width=11;
 define incent_comp_achieve_createdt / order order=formatted 'Incentive*Component*Achievement*Created Dt' width=11;
 define elig_ruleset / order order=formatted 'Eligibility*Classification' width=11;
 define eff_cnt / analysis sum noprint;
 
 compute before incent_plan_effdt;
  last_name = "";
  uniqsub = 0;
  uniqsub+eff_cnt.sum;
    endcomp;
 
 break after incent_plan_effdt / summarize;

 compute after incent_plan_effdt;
  /* Test No Records */
  If incent_plan_effdt ^= . then
     do;
     last_name = "";
     subscriber_id = uniqsub;
        subscriber_and_sfx = uniqsub;
  end;
 
 endcomp; 

 compute before incentive_plan_name;
  last_name = "";
     ipname = incentive_plan_name;
  uniqmem = 0;
  uniqmem+eff_cnt.sum;
    endcomp;

 break after incentive_plan_name / summarize;

 compute after incentive_plan_name; 
  /* Test No Records */
  if incentive_plan_name ^= ' ' then
     do;
     last_name = "";
     incent_plan_effdt = ' ';
     incentive_component_name = 'Count';
        if uniqsub > uniqmem then
           do;
             subscriber_id = uniqsub;
             subscriber_and_sfx = uniqsub ;
         end;
        else do;
               subscriber_id = uniqmem;
               subscriber_and_sfx = uniqmem;
          end;   
        end;
    endcomp;

    compute before incentive_component_name;
  last_name = "";
  subcnt=0;
     subsfx_cnt=0;
    endcomp;
 
 break after incentive_component_name / summarize;

    compute after incentive_component_name; 
  /* Test No Records */
      
  if incentive_component_name ^= ' ' then
     do;
     last_name = "";
     incent_plan_effdt = ' ';
        incentive_plan_name = ' ';
        subscriber_id = subcnt;
        subscriber_and_sfx = subsfx_cnt;
  end;
    endcomp;

 compute last_name;
  /* Correct issue of blank last names */
  if last_name ne ' ' then hlast_name = last_name;
  if last_name eq ' ' then last_name = hlast_name; 
 endcomp;

    compute after subscriber_id;
  subcnt+1;
    endcomp; 

 compute after subscriber_and_sfx;
  subsfx_cnt+1;
 endcomp;

run;

 

#1 Report output:

Last Name First Name
Boss Tom
Smith Brenda
Smith  
Johnson James
Johnson  
Taylor Mike
Teller Jones


 

#2 Report should look like this:

 

Last Name First Name
Boss Tom
Smith Brenda
Johnson James
Taylor Mike
Teller Jones

 

2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
Given the fact that your data sent thru PROC REPORT is producing the break line you don't want, it is nearly impossible to answer your question without actually seeing the data that you're using and understanding why you are coding the computer block logic you are coding.
cynthia
nupedoc79
Fluorite | Level 6

I apologize for the delay but thanks all I figured out the issue, it was minor.

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
  • 2 replies
  • 991 views
  • 0 likes
  • 2 in conversation