BookmarkSubscribeRSS Feed
Hoffy
Calcite | Level 5

I am not having any luck in getting the universal viewer 1.42 to filter a date.  I go through the advanced point and click to select my variable, operator, and condition.  Here is what I get constructed by the process

 

Convert([Default_Date],'System.DateTime')<#2010/01/01 08:46:21#

 

I don't have any idea where it gets the timestamp of 08:46:21 unless from my login time.  I only have 365 observations so the execution time shouldn't be the issue.  I have even editted the timestamp portion to 00:00:00 and still no filtering takes place.

 

I have had no issues with filtering numeric or text variables, just the simple date.  Any help will be much appreciated.

5 REPLIES 5
Jagadishkatam
Amethyst | Level 16
I believe you need to subset the datetime data based on the numeric datetime value. I mean the datetime values without the format. Or you need to use the datetime literal '01/05/2017:08:00:00'dt like this to subset.
Thanks,
Jag
Hoffy
Calcite | Level 5

The date as you presented is not recognized in the univ viewer.  I can subset using the numeric value of the date but that is such a klutzy way to do it.  If I actually have a specific date that I want to use, it has to be highlighted and then remove formating to see the value.  The syntax is created by the point and click, it can be editted but still has to conform to the viewer syntax rules.  The Universal Viewer is great to just browse a dataset and the subsetting on numeric and text is sort of straight forward.  The date subsetting, except for the numeric conversion, just doesn't work.  I do have a SAS support track on it but thought I would also reach out to anyone that may use the viewer and figured out a way to use the date without converting to the numeric value.  Thanks.  If I get a resolution I will post it here.

 

Peter_C
Rhodochrosite | Level 12
Datetime constant uses 3 letters for month like
'29May2017:20:33'dt
Hoffy
Calcite | Level 5

I really appreciate you takeing the time to submit a solution.  Unfortunately the SAS Universal Viewer doesn't use SAS syntax, it is strickly point and click process to create the commands to be submitted.  You can edit it's created  syntax but it has to follow the format that I submitted with this track.  I have tried all the known proper SAS date formats including those used with various database packages.  I have a problem track on SAS support. I am hoping they  can find a solution to how to subset dates in the Universal Viewer.

Hoffy
Calcite | Level 5

This is an update on the progress, or lack of, to find the way to subset date and datetime variables.  The syntax is created by a point and click interface for filtering.  For date/datetime you have to use the Advanced Filtering.  You can edit the created syntax but still must follow a non-SAS like syntax. I have been able to subset two datetime variables in a dataset but still have to manually edit the right hand portion of the selection. Not being able to subset on a date/datetime variable and comparing it to a user entered date has escaped me for now. The last I heard from SAS Support they wanted a dataset, so I sent them my code that created a test two observation, two variable dataset with a datetime and a character variable. I haven't heard from them since sending it.

 

If I get a useable way to do the subsetting I will post it here. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5 replies
  • 921 views
  • 0 likes
  • 3 in conversation