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

proc tabulate data=PlaceBaseSet missing out=Place;

    class location age academic_period;

    table location*age all*age, academic_period;

run;

data Place; set Place;

     if n=. then n = 0; /* row does not exist so this does not work*/

run;

proc print data= Place;


In SAS 9.2, I am attempting to convert a dataset to proc tabulate.  From tabulate I want to convert it to a tabular dataset.  The code for converting from proc tabulate is above.  My tabular dataset cannot have missing values.  I found that a missing value in a tabulate structure is not included in the resulting tabular data.  Is there a way to save nulls in proc tabulate to a value of zero?

1 ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3
ballardw
Super User

If you could provide a few rows of data for PlaceBaseSet and the desired final outcome we might be able to help better. Or at least of the starting Place set.

You might need a MISSING option on your class statement. I would not expect anything to be missing from the output of tabulate in this case as tabulate by default excludes any records with missing values for the class variables unless explicitly told to include them in the summary.

DavidPhillips2
Rhodochrosite | Level 12

missing cell1.png

proc print displays

111201110111114621
211201210111114758
311201310111114595
411201410111114261
511201510111114155
612201110111115
712201210111114
812201310111114
912201510111119

there should be a row between 8 and 9.  Apparently "7 really ate 9".

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!

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
  • 3 replies
  • 960 views
  • 3 likes
  • 3 in conversation