SAS Procedures

Help using Base SAS procedures
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
azertyuiop
Quartz | Level 8

Hello , good morning,

I want place a condition "where " in a proc export like this :

proc export data=work.refec9 (where=(acteur="toto") (statut<>"tata")) outfile="\\serveur\\dossier\sousdossier\truc.xlsx" dbms=XLSX replace ;
sheet="a_traiter";
run;

I have tried to follow the law which are here with unsuccess : http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001000998.htm

 

Can you give me your opinion

 

Thanks for the help

 

[KB] fixed the link

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

A where condition needs to be a syntactically valid boolean expression.

(acteur="toto") (statut<>"tata")

clearly is not.

(acteur="toto" and statut<>"tata")

or

(acteur="toto" or statut<>"tata")

are.

 

You just have to keep reading on in the documentation:

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000131192.htm

View solution in original post

4 REPLIES 4
Kurt_Bremser
Super User

A where condition needs to be a syntactically valid boolean expression.

(acteur="toto") (statut<>"tata")

clearly is not.

(acteur="toto" and statut<>"tata")

or

(acteur="toto" or statut<>"tata")

are.

 

You just have to keep reading on in the documentation:

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000131192.htm

azertyuiop
Quartz | Level 8

Excellent for your link , I keep this in my paper note .

RW9
Diamond | Level 26 RW9
Diamond | Level 26

This:

(where=(acteur="toto") (statut<>"tata"))

 

Is not a valid where clause.  Where clause take the form:

where <condition> [logical operator <condition>];

 

So:

(where=(acteur="toto" and statut<>"tata"))

Would work.

You are trying to do a where clause like its options - e.g. keep or drop or where.

azertyuiop
Quartz | Level 8

I have tried this code :

 

proc export data=work.ma_table (where=(champ1<>"XXXX" and champ2="YYYY" )) outfile="\\serveur\\dossier\sous dossier\\fichier.xlsx" dbms=XLSX replace ; sheet="nomfeuille2"; run;

It's ok in my side , there is a result in out 😄

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 19439 views
  • 2 likes
  • 3 in conversation