hello
not= does not work in my program. what is the error? thanks
roc sql;
create table stat_data as
select * from Penality
where
specific_Industry_of_Parent not = 'mortgage lending' or specific_Industry_of_Parent not = "commodity trading; mining" or specific_Industry_of_Parent not= 'banking'
or specific_Industry_of_Parent not = "insurance" or specific_Industry_of_Parent not = "financial services" or specific_Industry_of_Parent not = "banking & securities"
or specific_Industry_of_Parent not = "investment advisory services";
run;
Use NOT IN instead of NOT =
And SQL requires a QUIT, not RUN.
I'd also recommend using either single or double quote consistently but that's not something I excel at either 🙂
Something like this is a lot cleaner IMO:
proc sql;
create table stat_data as
select * from Penality
where
specific_Industry_of_Parent not in (
'mortgage lending',
"commodity trading; mining",
'banking',
"insurance",
"financial services",
"banking & securities",
"investment advisory services");
quit;
@sasphd wrote:
hello
not= does not work in my program. what is the error? thanks
roc sql;
create table stat_data as
select * from Penality
where
specific_Industry_of_Parent not = 'mortgage lending' or specific_Industry_of_Parent not = "commodity trading; mining" or specific_Industry_of_Parent not= 'banking'
or specific_Industry_of_Parent not = "insurance" or specific_Industry_of_Parent not = "financial services" or specific_Industry_of_Parent not = "banking & securities"
or specific_Industry_of_Parent not = "investment advisory services";run;
there is no error in the log but the input table did not change
Change "not =" to "ne".
Use NOT IN instead of NOT =
And SQL requires a QUIT, not RUN.
I'd also recommend using either single or double quote consistently but that's not something I excel at either 🙂
Something like this is a lot cleaner IMO:
proc sql;
create table stat_data as
select * from Penality
where
specific_Industry_of_Parent not in (
'mortgage lending',
"commodity trading; mining",
'banking',
"insurance",
"financial services",
"banking & securities",
"investment advisory services");
quit;
@sasphd wrote:
hello
not= does not work in my program. what is the error? thanks
roc sql;
create table stat_data as
select * from Penality
where
specific_Industry_of_Parent not = 'mortgage lending' or specific_Industry_of_Parent not = "commodity trading; mining" or specific_Industry_of_Parent not= 'banking'
or specific_Industry_of_Parent not = "insurance" or specific_Industry_of_Parent not = "financial services" or specific_Industry_of_Parent not = "banking & securities"
or specific_Industry_of_Parent not = "investment advisory services";run;
Since this seems to select as expected:
proc sql; create table junk as select * from sashelp.class where sex not = 'F' ; quit;
perhaps the issue is with the spelling of your values. = would be case and space sensitive.
Run this and show the result:
proc sql; select distinct specific_industry_of_Parent from Penality ; quit;
Any chance the data set is actually named "Penalty" and not "Penality"?
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.