SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Missing values

Accepted Solution Solved
Reply
Contributor
Posts: 25
Accepted Solution

Missing values

Hi everyone, I want to delete rows of TICKERs with all RETURNs missing. For example,  say I have a table  of the form below and my aim is to delete rows whose TICKER = AST and keep TICKER = AAPL eventhough one of its RETURN observations is missing.

 

DATE                               TICKER               RETURN

01/01/2016                       AAPL                     .

02/01/2016                       AAPL                    0,17

01/01/2016                       AST                        .

02/01/2016                       AST                        .

01/01/2016                       FOX                     -0.2

02/01/2016                      FOX                       0.56

 

Any help will be appreicated. Cheers all.

 


Accepted Solutions
Solution
‎10-16-2016 03:27 PM
Super User
Posts: 17,836

Re: Missing values

Proc SQL;

create table want as 

select * from have

Group by ticker

having max(ticker) ne .;

quit;

View solution in original post


All Replies
Super User
Posts: 6,939

Re: Missing values

if ticker = 'AAPL' or return ne .;

subsetting if.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎10-16-2016 03:27 PM
Super User
Posts: 17,836

Re: Missing values

Proc SQL;

create table want as 

select * from have

Group by ticker

having max(ticker) ne .;

quit;

Contributor
Posts: 25

Re: Missing values

I don't know how I didn't think about that. Thank you.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 379 views
  • 0 likes
  • 3 in conversation