BookmarkSubscribeRSS Feed
Ashwini
Calcite | Level 5

  have a sas datasetcustomer detail like

Customerno   Customerid customername  productname productcode  porchdate

CN111          111               RAM              FREEZE        PD1             09JAN2012

CN112          112               HARI             TV                  PD2            10JAN2012

CN113          113               GOPAL          FAN               PD3            04JAN2012

CN111          111               RAM              TV                  PD2            12JAN2012

CN112           112               HARI             FREEZE         PD1            13JAN2012

CN113           113               GOPAL          TV                  PD2            15JAN2012

Productcode:-PDI is FR

                      PD2 is T

                     PD3 is  FN

I have to create a stored process .In this storeprocess  I have to create 3 dropdown selection like Customername,Productname, productcode.

1.  select customername RAM  and TRUE .

      It show below detaillike

Customerno   Customerid customername  productname productcode  porchdate

CN111          111               RAM              TV                  PD2            12JAN2012

CN111          111               RAM              FREEZE        PD1             09JAN2012

2. selectcustomername HARI and TRUE

  Customerno     CN112

Then it show like

Customerno   Customerid customername  productname productcode  porchdate

CN112          112               HARI             TV                 PD2             10JAN2012

CN112           112               HARI             FREEZE         PD1            13JAN2012


3. selectproductcode FR only it show

Customerno   Customerid customername  productname productcode  porchdate

CN111          111               RAM              FREEZE        PD1             09JAN2012

CN112           112               HARI             FREEZE         PD1            13JAN2012

4.If we select customername  HARI and TRUE

                   Customerno       CN112

                  Productcode       FR

It show like

Customerno   Customerid customername  productname productcode  porchdate

CN112           112               HARI             FREEZE         PD1           13JAN2012                  

Kindly help me to create this program using macro and basesas and sas sql.

Thanksand Regards,

Ashwini

2 REPLIES 2
Ashwini
Calcite | Level 5

Any body can help me to code above condition.

Cynthia_sas
SAS Super FREQ

Part of this question was already answered in this posting: http://communities.sas.com/thread/33031?tstart=0

And this is a very good paper on how to approach writing a macro program: http://www2.sas.com/proceedings/sugi28/056-28.pdf

Also, it is not clear to me what you mean by this:

"1. select customername RAM and TRUE ." or

"2. selectcustomername HARI and TRUE"

This would indicate some kind of WHERE condition like:

proc print data=mydata;

  where customername="&selectcustomername" and ????????"; but where does the TRUE come from in the data that you show what is the variable or condition that must = "TRUE"????

Also, the 2 conditions in #2 and #4 are the same, but you show different results.

cynthia

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 676 views
  • 0 likes
  • 2 in conversation