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

Hello,

  I have 2 Variables:  Star, bin_NAV.   

   - Star is the ordinal scale where its data included  2-star, 3-star, 4-star and 5-star.

   - bin_NAV  is the ordinal scale where its data included  1, 2, 3, 4 and 5.

      (bin_NAV is created from proc hpbin to bin the ratio scale variable, NAV, into 5 classes)

I want to build histogram classify by Star by the following procedure.

Capture.PNG

The histogram show the value of bin_nav at 0 and 6, which are not in the data.  (See figure below)

What wrong is the code?

Thank You.

Capture2.PNG

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

UNIVARIATE doesn't know that you think the values of BIN_NAV are categories. It sees a numeric variable, considers it to be continuous, and bins them according to its default rule. You want to use the MIDPOINTS= option of the HISTOGRAM statement.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

UNIVARIATE doesn't know that you think the values of BIN_NAV are categories. It sees a numeric variable, considers it to be continuous, and bins them according to its default rule. You want to use the MIDPOINTS= option of the HISTOGRAM statement.

--
Paige Miller
Golf
Pyrite | Level 9
Thank You for your help.
Golf

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1279 views
  • 0 likes
  • 2 in conversation