DATA Step, Macro, Functions and more

non missing

Reply
Occasional Contributor
Posts: 11

non missing

How do I select the first non missing value??

 

Write a program to get the below O/P:
i/P:
1
12
123
1234


o/p:
0001
0012
0123
1234

Super User
Super User
Posts: 7,997

Re: non missing

1) What do you mean by "select the first"?  Do you only want to output to dataset the first one?  

2)

data want;
length op $4; set have; op=put(ip,z4.); run;

The Zx. format will put out the zeroes.

Super User
Posts: 19,877

Re: non missing

Your question statement has no relation to your desired output...

Occasional Contributor
Posts: 11

Re: non missing

I'am sorry, they are 2 different questions.

 And in the first question I mean to ask, if there are a set of observations with missing and non missing values of a variable, how can I output the 1st non missing value of that variable.

 

Thank you.

Super User
Posts: 19,877

Re: non missing


shynu wrote:

I'am sorry, they are 2 different questions.

 And in the first question I mean to ask, if there are a set of observations with missing and non missing values of a variable, how can I output the 1st non missing value of that variable.

 

Thank you.


 

 

Post sample input/output as well. 

Ask a Question
Discussion stats
  • 4 replies
  • 154 views
  • 0 likes
  • 3 in conversation