- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
need help to convert below sql query into proc sql or data set query of sas
Select x.*
from yyy x
inner join
(
select abc, ad, min(date) as Minad
from dbo.xx
where xx in ('xx' ,'xx' ,'xx' ) AND Activity_Date >= 'mm/dd/yyyy'
group by case_ID, Activity
)
as b on a.abc = b.abc and a.ad=b.Minad
where (a.ad)>= 'mm/dd/yyyy' and a.abc in ('xx' ,'xx' ,'xx' ) AND B.xx IS NOT NULL
group by a.abc,a.xx,b.xx
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
need help to convert below sql query into proc sql or data set query of sas
Select x.*
from yyy x
inner join
(
select abc, ad, min(date) as Minad
from dbo.xx
where xx in ('xx' ,'xx' ,'xx' ) AND Activity_Date >= 'mm/dd/yyyy'
group by case_ID, Activity
)
as b on a.abc = b.abc and a.ad=b.Minad
where (a.ad)>= 'mm/dd/yyyy' and a.abc in ('xx' ,'xx' ,'xx' ) AND B.xx IS NOT NULL
group by a.abc,a.xx,b.xx
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
As I read it, there is nothing in your code not supported by PROC SQL in SAS, so simply wrap it inside a PROC SQL call.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It gives syntax error
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What error appears in the log?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Post your FULL LOG.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If activity_date and ad are SAS dates, and 'mm/dd/yy' are actually numbers, you should use the form:
AND Activity_Date >= 'ddmonyyyy'd
Art, CEO, AnalystFinder.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@art297 good catch 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I do not completly understand the query. But most of it should work in Proc SQL too. Except few changes where you mention date columns and at is not null.
Activity_Date >= 'mm/dd/yyyy'
to
Activity_Date >= 'ddmmmyyyy'd example '21jul2017'd
is not null
to
is not missing