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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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