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

Hello,

 

I want to know if I give any conditional arithmetic expression then can I view whole datasets?

 

Example - if I have List of employees with Department and Salary and I have to calculate incentives for specific department but I want to view whole data set and not only those specific employees.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Do not apply a where or subsetting if statement if you want the other records. You would conditionally assign values.

 

data want;

   set have;

   if department = 'SALES' then incentive = salary* 0.1;

run;

would only add an incentive for the specific department. All the other records would have missing values for incentive.

 

 

View solution in original post

3 REPLIES 3
Reeza
Super User

WHERE or subsetting IF removes those records. Instead of WHERE/IF consider creating a flagged variable to identify the records instead.

 


@rasika wrote:

Hello,

 

I want to know if I give any conditional arithmetic expression then can I view whole datasets?

 

Example - if I have List of employees with Department and Salary and I have to calculate incentives for specific department but I want to view whole data set and not only those specific employees.


 

ballardw
Super User

Do not apply a where or subsetting if statement if you want the other records. You would conditionally assign values.

 

data want;

   set have;

   if department = 'SALES' then incentive = salary* 0.1;

run;

would only add an incentive for the specific department. All the other records would have missing values for incentive.

 

 

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
  • 715 views
  • 0 likes
  • 3 in conversation