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

wildcards to remove zeros in my numeric variables

Accepted Solution Solved
Reply
Contributor
Posts: 35
Accepted Solution

wildcards to remove zeros in my numeric variables

Hi,

I have a dataset with a set of numeric variables. The names are like "a_1" to "a_8" up to "f_1" to "f_6". So the names are a letter, underscore and a number  (not all the numeric variables are like this, but most of them).

I want to remove all the zeroes in the numeric variables with the structure like the one above. But I cant get any kind of wildcards to work. Does anyone have any idea?

So far, my attempts has been like:

data dataset1;

set dataset1;

if b%= 0 then b%= ' ' ;

run;

Best regards,

Hank


Accepted Solutions
Solution
‎02-09-2014 08:14 AM
Respected Advisor
Posts: 3,777

Re: wildcards to remove zeros in my numeric variables

You are using the wrong syntax.  You will need to create and ARRAY using a SAS Variable List then you can iterate through the elements in the array and use an IF statement to change the values as you see fit.

View solution in original post


All Replies
Solution
‎02-09-2014 08:14 AM
Respected Advisor
Posts: 3,777

Re: wildcards to remove zeros in my numeric variables

You are using the wrong syntax.  You will need to create and ARRAY using a SAS Variable List then you can iterate through the elements in the array and use an IF statement to change the values as you see fit.

☑ This topic is SOLVED.

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

Discussion stats
  • 1 reply
  • 256 views
  • 1 like
  • 2 in conversation