BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
KoVa
Obsidian | Level 7

Hello,

 

I'm in the process of migrating a reporting table entirely to a SAS output through ODS excel. 

So far I have everything I previously had in the reporting layout that was done in excel, except for one thing. 

I have a macro that alters the borderline of a row based on the cell value of a certain column (I have attached an example of this). 

the report is pre-sorted, the macro just runs through the column and if it's the same value as the previous value (the one above in the sheet) the whole row is give a thin dotted bottomline. if not, there is a normal line (once again for the whole row of data). 

I've already found how to de-activate the gridlines, and other layout stuff, but I have yet to find this one... any help much appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions
KoVa
Obsidian | Level 7
since I cannot just past code here I just renamed columns to create 2 examples (yes with different headers and such), sorry.
Anyway, I think I have found what I was looking for by adding a column in a datastep first. should have searched a bit more, because I think I can use this:

https://communities.sas.com/t5/ODS-and-Base-Reporting/Controlling-borders-in-PROC-REPORT-and-ODS-Exc...

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

Many of us will not download attachments, especially Excel files which can be a security threat. Please show us a screen capture of the issue in Excel, use the "Insert Photos" icon (do not attach files).

 

Also, please show us the macro by copying the entire macro and pasting it into the window that appears when you click on the "little running man" icon.

--
Paige Miller
KoVa
Obsidian | Level 7

Screenshot 2022-10-25 152938.png

 

as requested here is a screenshot of an example. 

 

the code I use to generate the report is pretty basic

/*create sheet with links to enrollment*/
ODS EXCEL FILE=&linkr style=htmlblue options(
frozen_headers="ON" autofilter = "1-9" row_heights="30,13,13,13,13,13,13" flow = "header, data" 
absolute_column_width = "18,27,12,12,56,10,21,21" 
sheet_name = "&namer"
) ;
 
PROC report DATA=rep_&campaign nowd;
columns col1	col2 col3 col4 col5 link;
define col1 /
     style(header)={just=center }
     style(column)={just=center};
define col2 /
     style(header)={just=center }
     style(column)={just=center};
compute col3;
 call define(_col_,'url',link);
 if substr(col2,1,1) = 'P' THEN CALL DEFINE(_col_, "style", "STYLE=[BACKGROUND=cxFFFF99 textdecoration=underline color=blue]");
 if substr(col2,1,1) = 'A' THEN CALL DEFINE(_col_, "style", "STYLE=[BACKGROUND=lightgreen textdecoration=underline color=blue]");
 if substr(col2,1,1) = 'R' THEN CALL DEFINE(_col_, "style", "STYLE=[BACKGROUND=lightred textdecoration=underline color=blue]");
endcomp;

define link / noprint;
RUN ;

 
ODS _all_ CLOSE;

 

PaigeMiller
Diamond | Level 26

Nothing matches your original description. You mentioned a macro, but you don't show a macro. The code you show changes colors, decoration and background colors, but the Excel screen capture shows none of that. Your Excel screen capture shows INFO1 through INFO5, but your code shows none of that.

 

Please provide screen captures and code that are consistent with each other and consistent with your original explanation.

--
Paige Miller
KoVa
Obsidian | Level 7
since I cannot just past code here I just renamed columns to create 2 examples (yes with different headers and such), sorry.
Anyway, I think I have found what I was looking for by adding a column in a datastep first. should have searched a bit more, because I think I can use this:

https://communities.sas.com/t5/ODS-and-Base-Reporting/Controlling-borders-in-PROC-REPORT-and-ODS-Exc...

Cynthia_sas
SAS Super FREQ
HI, In addition to @PaigeMiller suggestions, you have a variable called LINK that you are using to create a URL but we don't see that value on the report because you have LINK set to NOPRINT. Also, LINK is at the end of the report row, but you are trying to use it in the COMPUTE block for COL3, which should fail. In addition, based on the data you show, none of your IF statements would work because as far as I can tell, nothing in your COL2 variable has values of 'P', 'A' or 'R'.
Cynthia
KoVa
Obsidian | Level 7
thx but it's already solved, found the answer elsewhere on this forum. should have looked a bit more first 🙂

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 6 replies
  • 1277 views
  • 1 like
  • 3 in conversation