Many thanks to @ballardw , @Mazi , @data_null__ @yabwon @tom_grant , @PaigeMiller and all others for your response.
I was able to solve the issue but not easy way but by macro way. Somehow finally I found that the approach by macro will be better for me so I went ahead with that and the issue is solved. I would share the steps of what I did below.
First I used cmiss function (works for numeric too) to find out if particular value is missing in a variable.
Then by creating another variable I found accumulating total of that variable (value of cmiss is 1 if the value is missing and 0 if it it not missing). In this way now I have count of number of values that are missing in a variable.
I kept the last row of this dataset (by end= option) and kept only those variable which will have counts of missing values.
By proc contents I found out how many rows are there in the given dataset.
I joined that dataset of proc contents with this dataset of one row.
If the dataset contains say 168 observations and if there 168 missing values for a variable, that means all the values are missing for that variable. (And that is what I was searching for: variables having all missing values).
Once found, I created a flag for those variables for which number of missing values are number of records in the dataset.
All this I put in the macro which will do it for all the variables one by one by using do while loop.
And in this way the issue was solved. I would have liked to share the code for this but I will not be able to do it because I will need to type out the code again and that is very time consuming.
Many thanks to all those who responded. It was a fun exercise for me. I thought I will be able to avoid macro but later I found that macro is a better way to solve it. As I found this answer working for me, I will mark this as accepted answer.
Thank you.
- Dr. Abhijeet Safai
... View more