Help using Base SAS procedures

Select value in proc sql from YYQ function

Accepted Solution Solved
Reply
Regular Contributor
Posts: 186
Accepted Solution

Select value in proc sql from YYQ function

Hi,

Lets say I do the following steps in a data steps;

data mytest.test;

  set mytest.data;

  Quarter=yyq(2012,1);

  format Quarter yyqs8.;

run;

Quarter variable will be 2012/1 for this table

Now, how do I select the first quarter of 2012 in a proc sql query :

proc sql;

  create table myquartertest

  select * from mytest.test

  where Quarter = "2012/1";

quit;

Thank you for your help and time.


Accepted Solutions
Solution
‎05-14-2013 05:54 PM
Super User
Posts: 10,460

Re: Select value in proc sql from YYQ function

Try :

where year(quarter)=2012 and qtr(quarter)=1;

View solution in original post


All Replies
Solution
‎05-14-2013 05:54 PM
Super User
Posts: 10,460

Re: Select value in proc sql from YYQ function

Try :

where year(quarter)=2012 and qtr(quarter)=1;

Regular Contributor
Posts: 186

Re: Select value in proc sql from YYQ function

Thank you very much for the quick reply.

Works like a charm.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 890 views
  • 0 likes
  • 2 in conversation