BookmarkSubscribeRSS Feed
rabkabizan
Calcite | Level 5

Hi all,

I'm trying to generate a custom HTML report using data _null_ and the _webout fileref in SAS Studio. I'm injecting my own CSS styles directly into the HTML using PUT statements, but the CSS doesn't seem to apply at all when viewed in the SAS Studio results pane.

Here’s a simplified version of my code:

 

data _null_;
    file _webout;
    put '<style>';
    put '*,*:before,*:after{box-sizing:border-box}';
    put 'body{font-family:Arial,Helvetica,sans-serif;margin:0;padding:18px;}';
    put '.pm{max-width:820px;margin:0 auto;}';
    put '.pm-title{font-size:22px;font-weight:700;color:#2b5c83;';
    put '  border:2px solid #2b5c83;padding:10px 14px;border-radius:6px;';
    put '  margin-bottom:14px;display:inline-block;}';

    put '.card{border:1px solid #d9dee6;background:#f4f6f8;margin:10px 0;';
    put '  border-radius:8px;padding:16px 18px;}';
    put '.card.top{background:#e9f7e6;}';

    put '.card h3{margin:0 0 10px 0;font-size:16px;color:#2d4c6b;}';
    put '.card h3 .method{font-weight:700;text-decoration:underline;}';

    put '.metric{margin:8px 0;}';
    put '.metric .label{font-weight:700;color:#333;margin-bottom:4px;}';
    put '.metric .value{font-size:14px;color:#333;}';
    put '.metric .value.big{font-size:32px;line-height:1;color:#3a7bd5;';
    put '  font-weight:800;letter-spacing:0.5px;}';
    put '.metric .value.rate{font-size:18px;font-weight:700;}';
    put '</style>';

	put '<div class="pm">';
run;

data _null_;
    set public.prediksi_premium_rate_row;
    file _webout mod; 
    put '<div>';
    put '  <h3>Model <span class="method">' metode '</span></h3>';

    put '  <div class="metric">';
    put '    <div class="label">Premium</div>';
    put '    <div class="value big">' premium comma20 '</div>';
    put '  </div>';

    put '  <div class="metric">';
    put '    <div class="label">Premium Rate</div>';
    put '    <div class="value rate">' rate COMMA12.4 '</div>';
    put '  </div>';
    put '</div>';
run;

data _null_;
    file _webout mod;
    put '</div>';
run;

However, the styles are not applying at all (the text doesn’t change size or color). I'm expecting it to look styled, but it's just plain unformatted HTML.

My question is, why isn't the CSS applying in the _webout output in SAS Studio?

Any help would be greatly appreciated!

Thanks in advance.

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 0 replies
  • 406 views
  • 0 likes
  • 1 in conversation