BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
need_some_help
Calcite | Level 5

Hello.

Maybe, my problem is not a problem indeed but as a SAS-novice I got totally confused - there is a lot of information but unfortunately I can't find any appropriate for me(

The thing is (in SAS Enterprise Guide):

     I get PDF-report after running List Report, there is a table with totals for some columns in the bottom of the table.

     I need to make another font (font-style) for this row (with totals) and change column width and justify column cells content.

All I managed to do for the moment is:

     created a new style (using existing one), changed some it's attributes - in Style Manager,

     added a Program to my Project (without it my style can't be found) with code:

          proc template;

               define style mystyle;

               parent=styles.plateau;

               end;

          run;

How and where (Style Manager or Proc template-code) should I specify the features I need?

Be very grateful for any help!

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

Sorry, my bad, I saw the 'List' and mentally filled in List Data versus List Report.  There is a List Data task that uses PROC PRINT. The List Report task generates PROC REPORT code. But, the STYLE= override, just changed a bit would work for PROC REPORT. The general idea of STYLE= overrides, works with PROC REPORT the same way it does for PROC PRINT. For example, where I had STYLE(TOTAL) in the PROC PRINT code, you would have STYLE(SUMMARY) on the PROC REPORT code, in the PROC REPORT statement:

proc report data=sashelp.class nowd

     style(summary)={font_size=16pt font_weight=bold

                     background=yellow};

  column age name height weight;

  define age / order style(column)={cellwidth=1.5in};

  define name / order style(column)={just=c};

  define height /sum style(column)={cellwidth=2in};

  define weight/sum;

run;

  Again, the issue is that if you change the style template, you could make ALL the columns wider, but you could not make only the AGE or the HEIGHT columns wider. The Wizard only generates the basic PROC REPORT code, I do not believe the wizard gives you the choice to alter the STYLE. So if you wanted to change the width of ONLY the AGE column, as shown above, you would have to use a STYLE override. This presentation I did in 2010 shows some examples of using STYLE= overrides with PROC REPORT:

http://www.lexjansen.com/pharmasug/2010/sas/sas-hw-sas02.pdf

  If you use a numeric variable such as AGE (as shown above) for an ORDER or GROUP usage, you cannot also get a TOTAL for the AGE column -- a variable can only have ONE usage and the ANALYSIS or SUM usage (which is what you need to a numeric variable to give you a total) won't allow you to ORDER and the ORDER usage won't allow you to SUM. Some folks work around this by making a copy of the variable. If you look at this forum posting, I showed how to order on a total, by "pre-summarizing' the total and using a copy of the total column for ordering and then using the numeric version of the column for summarizing:

http://communities.sas.com/thread/30159

cynthia

View solution in original post

24 REPLIES 24
need_some_help
Calcite | Level 5

I've tried something like this, but it didn't work (apparently because of wrong name of table element?):

         proc template;

               define style mystyle;

               parent=styles.plateau;

               style column_total  /

                    font_style=roman

                    font_size=14;

               end;

          run;

need_some_help
Calcite | Level 5

Still trying, unsuccessfully....:

     proc template;

           define style user_defined_pdf;

                  parent=styles.plateau;      

            style cellcontents /

              font_style = roman

              cellwidth = .75in

              just = center

              ;

           end;

     run;

it seems to be not so difficult but I just can't find the right way to use this syntax(

Cynthia_sas
SAS Super FREQ

Hi:

  There's not a good way in the style template to change only the summary or total lines when you create a LIST report (with PROC PRINT). However, PROC PRINT does allow you to override the summary lines directly in the syntax. So if you edit the code (from the Code Preview Window), you can add the STYLE= overrides as shown in the code in my screen shot. I only used a few regions from SASHELP.SHOES -- but I used BY processing so you could see the difference between the totals for each region (yellow) versus the grand total (pink) and how each summary line was changed.

cynthia


show_override_proc_print.jpg
need_some_help
Calcite | Level 5

Hi)

Thank you very much for your response. But maybe I wrote wrong name of the task (I use version in my language) ... - as my List report is performed by Proc Report - so can I use changes of style there (where exactly? in Define statement?), and besides I have not only this change - I also want to make columns wider and change justification in some of them - is it better to change it in task code (not in style template)?

P.S.

There is an extra question about List report actually (I don't know if I can ask it here but maybe it was already discussed) - is there the way to sort summarizied columns (I've tried but when they are sorted the total value dissapear)?

need_some_help
Calcite | Level 5

To concretize P.S.:

my table consists of 4 columns: first is Region, second is Person's name, and the other two are some group characteristic of each person (I mean that in the input data there are few rows for each person which become one then with counted or summerized value and then in the last row of output table I have totals over all persons).

Hope you can understand me) and help) Thank you in advance.

Cynthia_sas
SAS Super FREQ

Hi:

Sorry, my bad, I saw the 'List' and mentally filled in List Data versus List Report.  There is a List Data task that uses PROC PRINT. The List Report task generates PROC REPORT code. But, the STYLE= override, just changed a bit would work for PROC REPORT. The general idea of STYLE= overrides, works with PROC REPORT the same way it does for PROC PRINT. For example, where I had STYLE(TOTAL) in the PROC PRINT code, you would have STYLE(SUMMARY) on the PROC REPORT code, in the PROC REPORT statement:

proc report data=sashelp.class nowd

     style(summary)={font_size=16pt font_weight=bold

                     background=yellow};

  column age name height weight;

  define age / order style(column)={cellwidth=1.5in};

  define name / order style(column)={just=c};

  define height /sum style(column)={cellwidth=2in};

  define weight/sum;

run;

  Again, the issue is that if you change the style template, you could make ALL the columns wider, but you could not make only the AGE or the HEIGHT columns wider. The Wizard only generates the basic PROC REPORT code, I do not believe the wizard gives you the choice to alter the STYLE. So if you wanted to change the width of ONLY the AGE column, as shown above, you would have to use a STYLE override. This presentation I did in 2010 shows some examples of using STYLE= overrides with PROC REPORT:

http://www.lexjansen.com/pharmasug/2010/sas/sas-hw-sas02.pdf

  If you use a numeric variable such as AGE (as shown above) for an ORDER or GROUP usage, you cannot also get a TOTAL for the AGE column -- a variable can only have ONE usage and the ANALYSIS or SUM usage (which is what you need to a numeric variable to give you a total) won't allow you to ORDER and the ORDER usage won't allow you to SUM. Some folks work around this by making a copy of the variable. If you look at this forum posting, I showed how to order on a total, by "pre-summarizing' the total and using a copy of the total column for ordering and then using the numeric version of the column for summarizing:

http://communities.sas.com/thread/30159

cynthia

need_some_help
Calcite | Level 5

Cynthia, thank you so much (I start with SAS at my new job and there's no one to ask even some stupid things so I have to disturb you and that's why I appreciate your help very much)!

I've got the difference between style template and style=overrides (and the last one works as I need) and now I'm trying to practice the information about my other needs, it's really helpful)

need_some_help
Calcite | Level 5

I don't fully understand how but I've managed to sort data in needed column (generally it's clear but sometimes different (order=)values and different order of column names in column statement give unpredictable (for me) results).

Unfortunately, new problems appeared:

there must be some text in my PDF-report and I thought it's simple to embed it (as I read I need just put this anywhere:     ods pdf text='my text' and after that my text will be placed on the page immediately following the last procedure output), so I wrote this statement just after proc report and waited for a miracle... but it caused such warning:

WARNING: Unsupported device 'ACTIVEX' for PDF destination. Using device 'ACTXIMG'.

NOTE: Writing ODS PDF output to DISK destination "C:\SAS\EMDesktop\Lev1\SASApp\sasprt.pdf", printer "PDF".

16 ods pdf text='my text';

17 ods pdf close;

NOTE: ODS PDF printed no output.

(This sometimes results from failing to place a RUN statement before the ODS PDF CLOSE statement.)

and as I've searched for that warning: 'This warning does not affect the results of the stored process execution and can be ignored.'

That's why I'm confused again.

    

need_some_help
Calcite | Level 5

I'm trying to circumvent this, but I only found out that 'my text' somehow goes to 'C:\SAS\EMDesktop\Lev1\SASApp\sasprt.pdf' (it's announced that results are loaded from there) where the output is not in my style (child style from the built-one which I described in Proc template) .

P.S.

It has just dawned upon me - style= overrides don't change the style I use, just changes my output? So changes done from parent style can be described in that way too and there will be no need to use Proc template.... Though I made all changes in Style manager and used Proc template only to define new style (to make SAS EG find it).

Cynthia_sas
SAS Super FREQ

Hi:

  You have a couple of issues, especially if you are trying to turn your code into a stored process. So, here goes:

1) Your error message...not all client applications for a stored process will use ODS PDF -- so, for example, if you run your stored process in Web Report Studio, the default destination for WRS is SASReport XML destination -- which means that your ODS PDF TEXT= is or could be incorrect. A simple fix is to remove the PDF from the ODS TEXT= statement. In the early days of TEXT=, you needed to specify a destination, but NOW, you can just have:

ODS TEXT='some string';

and the text will go to the OPEN destination, without you needing to know WHAT destination is being used by the client application.

          

2) Your driver message (use ACTXIMG and not ACTIVEX) -- somehow the device got set somewhere for ACTIVEX, which would be incorrect for PDF -- so again, this comes down to what client applications are going to receive your stored process results. Getting rid of this message can be easily fixed by issuing the appropriate override to the reserved macro variable that controls the device for graphics output.

This is one of those instances where seeing ALL of your code would be helpful. But, since you have not posted your code up to now and since you have just revealed that you want all your changes in a stored process, it might be better for you, at this point, to work with Tech Support on this question. They can look at ALL your code, look at what client applications you are using for the stored process and help you resolve your issues.

3) Yes, you are right. STYLE= overrides do NOT change the style template -- they override what is in the style template. This is especially nice in a client/server situation, where you may not want or be able to write your style template to a location on the server. Just because you store the style template on your local machine does not necessarily make the style template available to SAS on a server machine -- especially in the context of a stored process. In the case of the BI Platform, you really need to write your styles in a place that is accessible to the Workspace server and/or Stored Process server. And, some client applications, like WRS or PowerPoint may not use the style template you create because they can only receive SASReport XML from a stored process and sometimes, especially with WRS, you have to change the style in the XML that's embedded in the middle tier "plumbing" needed by WRS.

So the bottom line is that I would recommend you open a track with Tech Support. They are your best resource, at this point.

cynthia

need_some_help
Calcite | Level 5

Cynthia, thank you for your comprehensive responses! About my last issues - I'm not so trained to create stored processes yet) I' just need to make pdf-report from database data and your answers really helped me. I found the way to put text to my report with:

     compute after;

           line " ";

           line " my text ";

           line " ";

     endcomp;

even in the style I've wanted (using style(lines)= just after Proc report), and the ODS TEXT works too)

I'll study in detail information about client-server interaction and stored processes to avoid related problems. Thank you so much, for your help!

need_some_help
Calcite | Level 5

There's one more thing, as usual)

I' ve tried to change Title and text style. I thought it would be simple (there are examples everywhere like: ods text='^S={just=left font_style=roman} Text!' , but it just writes '^S={just=left font_style=roman} Text!' to my report - I've tried both single and doubled quotes). And 'my text' is in a frame, and I don't need it... What is wrong with my style settings?

need_some_help
Calcite | Level 5

Forgot to mention:

I changed User text (an other familiar elements) frame settings (Line style -> None, colour -> white) in Style manager for my new style (child from built in), but still frame appears..

And about 'code' way of changing style: I've also tried:     ods text='~S={just=left font_style=roman} Text!'.  Nothing changed(

need_some_help
Calcite | Level 5

And still that's not all...

I also trying to change title style and I've noticed such thing:

I use Title1 as a test string, Title2 is a real title and when I comment /* Title1 */ it still appears. Is it normal? If I don't specify Title1 (start from title2), it shows Title1 that was last specified?

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 24 replies
  • 2731 views
  • 13 likes
  • 2 in conversation