BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have some fisheries data that has what species was caught for a particular sampling effort, but not what species were not caught; i.e. not all species were caught during every effort, and only those that were caught were put into the data set. Therefore when density is calculated it only includes those efforts where there was a positive instance, thereby over inflating the density estimate. How would I go about working the data step so that the density calculation per species includes a zero for those times where that particular species was not caught+
2 REPLIES 2
LinusH
Tourmaline | Level 20
An idea:
First create a seperate table containing every possible combination of the PK columns (i.e. data, location, species): do a select distinct on your transactional data on the key columns (except species). Then create a cartesian product table by joining the result to a species table (containg all your species) without specifying join columns.

Now do a full join/merge with this table. In this step you can specify 0 for those rows populated from the cartesian table alone.
Data never sleeps
deleted_user
Not applicable
You could us "sparse" option in frequency procedure in producing 2 dimensional table. then use freq statement in KDE procedure.

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