labradorchik
asked on
How to output SAS dataset with variables without ASCII special characters or numbers?
I am trying to output SAS listing of variable "name" without ASCII special characters or numbers?
Below code is where variable "name" contains special characters and numbers. I just also would like to output datasets "data9" and "data10" from dataset "combined" without special characters or numbers.
Below code is where variable "name" contains special characters and numbers. I just also would like to output datasets "data9" and "data10" from dataset "combined" without special characters or numbers.
proc sql;
create table data5 as
select unique
name, Var4,
Var5
from combined
where (anyPunct(name) > 0);
create table data6 as
select unique
name, Var4,
Var5
from combined
where (anyPunct(name) > 0);
quit;
proc sql;
create table data7 as
select unique
name, Var4,
Var5
from combined
where (anyDigit(name) > 0);
create table data8 as
select unique
name, Var4,
Var5
from combined
where (anyDigit(name) > 0);
quit;
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Below code works and outputs variable "name" without any special characters or numbers but I also would like to create another filter:
if Var5 > 5 & < 20 then output to data9 and data10
How may I incorporate this to my already existing "where" statements
I tried below code but it still does not recognize Var5 > 5 & < 20, although, surprisingly no errors. Any comments or suggestions?
if Var5 > 5 & < 20 then output to data9 and data10
How may I incorporate this to my already existing "where" statements
proc sql;
create table data9 as
select unique
name, Var4,
Var5
from combined
where (anyPunct(name) = 0) & (anyDigit(name) = 0);
create table data10 as
select unique
name, Var4,
Var5
from combined
where (anyPunct(name) = 0) & (anyDigit(name) = 0);
quit;
I tried below code but it still does not recognize Var5 > 5 & < 20, although, surprisingly no errors. Any comments or suggestions?
proc sql;
create table data9 as
select unique
name, Var4,
Var5
from combined
where ((anyPunct(name) = 0) & (anyDigit(name) = 0)) &
where ((Var5 > 5 | Var5 < 20));
create table data10 as
select unique
name, Var4,
Var5
from combined
where (anyPunct(name) = 0) & (anyDigit(name) = 0) &
where ((Var5 > 5 | Var5 < 20));
quit;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The best possible answer was found while testing the code.
ASKER
Open in new window