BookmarkSubscribeRSS Feed
pscott
Calcite | Level 5

I have a table that loops kinda like below only with every combination of those three variables. And I would like to create a report based on every horizonal Column of that table E.g. one report would where comany = next, serial # = 965465, Tech= Superman and another where company = next , serial # = 56465, Tech = Jed.I'm not sure the best way to do this but I tried this and it failed. 

 

data MacSerial2;
set MacSerial2;
do i= 1 to 5;
%let Tech = Tech[i]
%let targetno2 = serial#[i]
%let targetno3 = company[i]

end;
run;

 

 

CompanySerial #Tech
Next965465Superman
Next56465Jed
Google2463Jed
Google1583Justice
Matt15612bad
5 REPLIES 5
Astounding
PROC Star

Without question, the best way would be to produce a report based on just the first observation.  Once you have that working, you can worry about how to extend that to additional observations.  The reporting requirements will dictate the methods you use to generate multiple reports.

pscott
Calcite | Level 5
Yes I have the report working properly I just need the variables to work properly!
Astounding
PROC Star

OK, since we're talking without specifics here, this would be one way:

 

data _null_;

set macserial2;

call execute( ... statements that would generate a report for a single observation ...);

run;

 

That approach generates the reporting statements for each observation individually.  There might be other ways, such as using a BY variable instead.  And note that CALL EXECUTE does have its tricky points if any macro language is involved. 

ballardw
Super User

Please explain what this is supposed to do?

data MacSerial2;
set MacSerial2;
do i= 1 to 5;
%let Tech = Tech[i]
%let targetno2 = serial#[i]
%let targetno3 = company[i]

end;
run;

 

It would help to provide a couple rows of input data and what you expect to happen with that input.

Reeza
Super User

@pscott wrote:

I have a table that loops kinda like below only with every combination of those three variables. And I would like to create a report based on every horizonal Column of that table E.g. one report would where comany = next, serial # = 965465, Tech= Superman and another where company = next , serial # = 56465, Tech = Jed.I'm not sure the best way to do this but I tried this and it failed. 

 


I have no idea what this means. Post an example please, you'll get an answer much faster.

 

For example, what are you defining as a report? Is that a sheet in Excel, a PDF page, a single Excel file and one for each company, or a single PDF file for each?  And what do you mean with the variable = (company=next...), are they printed across, or down or sideways...literally no clue with what you've stated here. 

 

You're using arrays incorrectly and mixed with macro's, which doesn't make sense in your sample code.  Help us help you by detailing your question. 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1347 views
  • 0 likes
  • 4 in conversation