BookmarkSubscribeRSS Feed
greesamu
Obsidian | Level 7

Hello!! 

 

I've made the below table to show the percent of women of each race in each county that have children of low birth weight (LBW). I'm perfectly happy with this table, but only got here through a typo. As you can see in the log, I misspelled my race variable once when defining the denominator.

 

I have two questions:

1. What code did SAS end up running if I had an "invalid denominator nesting element"? I'd like to know the actually correct code to yield this table.

2. Also, if someone could try explaining the aspect of why which variables get crossed in which ways in defining this denominator correctly. I've read through the guidance at the link below a few times but I'm still struggling to understand/apply this info in defining my own denominators. 

 

https://support.sas.com/resources/papers/proceedings13/134-2013.pdf

 

Thanks!!

Sam 

 

OutputOutputSyntax and LogSyntax and Log

2 REPLIES 2
ballardw
Super User

First, provide code or log as text pasted into a text box opened on the forum with the </> that appears above the message window.

 

It will be much easier for us to copy/edit/paste text to show corrections or suggestions to syntax which are next to impossible with pictures. Plus depending on things like screen resolutions of the monitors on both the maker and viewer the pictures can be difficult or impossible to read.

 

Mother_raceeth is nested within itself (can't copy and paste to show where that occurs) in several places

 

Without data and a pretty clear description of what value the denominators should be there really isn't an easy way to suggest what is needed.

From that paper you reference:

Determining which denominator definition is correct to use can be challenging. It is not always intuitive which
expression you should use when you are constructing the denominator definition. In addition, if there are
concatenated elements in an expression, the order of the elements matters. Whereas several combinations of
expressions might produce output, not all combinations produce the desired percentage. Consider what is required when you create a subtotal percentage

Also there is a suggestion immediately following the quote above: SIMPLIFY the table and add pieces one at a time to see if you get what you want. I would further add to create an use a data set where you can tell that the correct denominator is used.

 

A possible style point to consider: If you have variables that are numeric and coded as 1/0, where 1 means "has the characteristic of interest" you may want to consider using them as VAR variables instead of class. Then Mean="percent with characteristic", Sum="Number of interest". You would then possibly use the PCTSUM< denominator expression>

 

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
  • 2 replies
  • 635 views
  • 0 likes
  • 3 in conversation