BookmarkSubscribeRSS Feed
_Dan_
Quartz | Level 8

Hi,

 

I'm migrating some SAS code between two distinct SAS platforms. There's a section where I need a style for an ODS output. I expect this style will either have been hard coded or imported from a css file.

 

Assuming I can't find either the original style code or css, is there an export I can use that'll produce a file for me that I can import into the target platform?

 

 

Thanks in advance

 

Dan

9 REPLIES 9
Kurt_Bremser
Super User

Do not permeate a problem, fix it NOW. If you can't find the code to create the style, recreate it according to what you need in the style.

And let this be an object lesson: anything in SAS that does not have the creating code attached is worth shit. Styles, formats, macros, ....

_Dan_
Quartz | Level 8

Well, I 'run' the new platform, I've been asked to migrate people off an older platform onto this one. I'm taking it step by step, macros, formats etc as and when we come across them. The original code works on the old platform, so, like the macros, formats, all I need/want is a way to export the style.

 

Is that possible or not? I am going to assume the worst that there's either no original style code, no original css, and the analysts running the code had inherited it without knowing what the exact style information is.

Kurt_Bremser
Super User

This is from the documentation of the template procedure:

proc template;
source styles.default;
run;

You should be able to use that as a blueprint for retrieving the code for a given style.

_Dan_
Quartz | Level 8

Thanks for that, and it did work - almost.

 

A curve ball I've just found is that the Style is defined within their code:

proc template; 
define style TheStyleName; 
parent = Styles.fancyprinter;


However, when referring to the style...

WARNING: Could not locate style reference 'TheStyleName.colors("docfg")'.

As this reference isn't explicitly set through the proc template, could it be that there's another Style with the same name that does contain those colours?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

You would need to be more specific.  Is is a SAS style which is done via Template language, if so you then you can simply find your style:

http://support.sas.com/techsup/notes/v8/36/900.html

 

Then list the code used.  Move this code used over to the new system and run it.

http://support.sas.com/kb/23/442.html

 

If it is a css then find that file on your network and copy the file over.

_Dan_
Quartz | Level 8

Great, looks like that'll cover the extracting of the style, but if you check out my reply I've just written, do you have any ideas why the style isn't "complete" insofar as the colours are missing?

_Dan_
Quartz | Level 8

I've just read this:

http://support.sas.com/kb/33/356.html

 

Which completely explains the issue.

"The workaround for the code above is to use the FROM option with the style element name"

 

I did so and I am left with a single remaining warning, whereas a previously had about thirty of them. 

 

So the answer is to change this:

style colors 

 

To this:

 style colors FROM COLORS 

ballardw
Super User

@_Dan_ wrote:

Hi,

 

I'm migrating some SAS code between two distinct SAS platforms. There's a section where I need a style for an ODS output. I expect this style will either have been hard coded or imported from a css file.

 

Assuming I can't find either the original style code or css, is there an export I can use that'll produce a file for me that I can import into the target platform?

 

 

Thanks in advance

 

Dan


If you have access to the style, as in able to use Style=mystyle in ODS destinations, then Proc Template can derive the original source with something like this referencing your style: (replace styles.meadow with your style).

proc template;
   source styles.meadow;
run;

The listing of the code needed to generate the style will appear in the log, or use proc printto to direct the output to a file.

 

Warning: If there is a PARENT style listed (most will reference Styles.Normal) you will also need to generate that one's source code (repeat until you have Styles.Normal as the parent AND get the definition of Styles.Normal) as variations between releases do not mean that the parent style will remain unchanged (or even exist) in another release. And if it exists the modification that your customization is based on may not work as the parent's elements may differ.

 

I ran into the parent changing in the past and my code for a custom version based on the "new" parent did not generate any errors but the output did not match expectations because the parent changed how some base elements were defined and my custom style no longer had those elements to modify.

 

To recreate things you would likely want to make sure that you do not overwrite any of the parent styles in the new installation but create new named versions and change the parent references. Or merge the code by hand. With literally hundreds of lines of code in some of the styles that would be my last resort.

_Dan_
Quartz | Level 8

Thanks for your detailed response ballardw.

 

You've obviously come across a similar issue to me, and I have in fact found the culprit which was the change in behaviour between SAS versions (see my reply above yours).

 

It's all good knowledge to keep though. Your answer would have gone quite some way to helping me had I not stumbled across one of the very specific warnings & resolutions on the interwebs.

 

 

 

Cheers

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 9 replies
  • 1248 views
  • 2 likes
  • 4 in conversation