BookmarkSubscribeRSS Feed
AshokD
Obsidian | Level 7

Hi All,

 

I'm new to the Base SAS Concepts.

 

Can anyone help me on the below scenario

 

I'm having dataset called FINALand it has the below records

 

S.no Name   July_salary(Field1)   August_Salary(Field2)

 

1      xxxx        20000                       21000             

 

2      yyyy        34000                       30500

 

3     zzzz         89000                       --------

 

Creating two datasets by keeping FINAL datatset.

 

Data 

         Match

         Unmatch;

    SET

          FINAL;

................. ?????????

 

I need to report if the Field1 is exists or >0 and Field2 is exists or >0 then output to Match Dataset else output to UnMatch Dataset

 

So Match dataset should contain 1 & 2 row  and Unmatch dataset should contain 3 row.

 

Could you please share your ideas on how to proceed with this ?

 

Thanks

1 REPLY 1
Reeza
Super User
You question is still unclear, what do you mean "exists"? That it's not missing? if so you can use the n or nmiss() function.

data match unlatch;
set final;
if nmiss(field1, field2)>0 then output unmatch;
else output match;
run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1 reply
  • 689 views
  • 0 likes
  • 2 in conversation