BookmarkSubscribeRSS Feed
LB
Quartz | Level 8 LB
Quartz | Level 8

Hello all-

I have a "month" field that stores the values (5 digits) as a number vs a SAS date value. I can still  use formats as such as mmddyy10. and it works fine except when I need to use it in a SG template and then I get an error for what I need to do. Any help much appreciated.

How can I convert this over to an actual date value per se.

Thanks

Lawrence

8 REPLIES 8
Reeza
Super User

Generally you still need SAS dates no matter what procedure.

Can you provide more information? Is the SG Template custom designed (SG Render) or from a specific proc.  Can you modify the template?

And what's your errror?

LB
Quartz | Level 8 LB
Quartz | Level 8

Reeza;

My partial template is as follows below. The problem is that I am using the interval option=month in the xaxisopts as I want all the monthly values displayed. And this works until I stick in the x reference line and then kablu-ee-

The tick dates now go quarterly and the referent line no longer syncs with Aug13 but is staggered. It should be sitting right on the dateline.

You can see the issue in the first image.

The second image has all the date ticks sans referent line.

the message I get is:

NOTE: Time axis can only support date time values. The axis type will be changed to LINEAR.

So does this mean that it needs a datetime value such as 01SEP13:00:00:00?

All my dates are stored as datew.

Thank you for your time.

Lawrence

define statgraph BarLineMOB; /*CREATES TEMPLATE FOR HAP MOBILTY RATE GRAPHS FOR EACH FACILITY*/

    begingraph;

       layout overlay / xaxisopts=(timeopts=( tickvalueformat=monyy. splittickvalue=false /*viewmin='01OCT12'D viewmax='01AUG13'D */interval=month)) 

yaxisopts=(LABEL=('PERCENT AMBULATED') offsetmin=0.05 offsetmax=0.05 griddisplay=on  linearopts=( viewmin=0 viewmax=.7)) ;

           referenceline y=.5 /lineattrs=graphdatadefault(thickness=3 color=black)  CURVElabel='Target=50%' CURVELABELPOSITION=auto Curvelabellocation=inside;

           referenceline x=19571/lineattrs=graphdatadefault(thickness=3 color=black)  CURVElabel='Change in Process Metric Calculation* ' /*CURVELABELPOSITION=auto Curvelabellocation=inside*/;

          seriesplot x=month y=PCT_COMPLIANCE / lineattrs=graphdatadefault(thickness=3 color=black) name="PERCENT AMBULATED"    LEGENDLABEL="PERCENT AMBULATED" ;

      

         scatterplot x=month y=PCT_COMPLIANCE / GROUP=grp_color index=index  includemissinggroup=false  markerattrs=(symbol=circlefilled size=15) name="Status"    LEGENDLABEL="Status";

          scatterplot x=month y=PCT_COMPLIANCE /includemissinggroup=false markerattrs=(symbol=circle size=16 color=black) ;

          *scatterplot x=month y=PCT_COMPLIANCE / GROUP=grp_color index=index1 discreteoffset= -0.1 includemissinggroup=false markercharacter=PCT_COMPLIANCE   markercharacterattrs=(/*color=white*/ weight=bold );

   

       

          discretelegend   /*"HAP RATE PER 1000 ADMITS"*/ "Status" /

    location=outside  valign=bottom;

  

       endlayout;

     endgraph;

end;

end;

This image happens when I add the referent line-date marks go quarterly.

Display_wrong.png

All date ticks appear

Display_dates_wo_referent.png

ballardw
Super User

It looks like you want a datetime variable

dt = dhms(date,0,0,0);

would create a new variable for midnight(start of day);


LB
Quartz | Level 8 LB
Quartz | Level 8

Ballrdw;

Well, it didn't like that either...Although that is what I though SAS wanted as well.

Lawrence

Reeza
Super User

What version of SAS are you on? SG options change 

Did you use SG Designer to get the code or write it yourself?

Can you provide some data and I'll test it out on my side (have sas 9.3)

LB
Quartz | Level 8 LB
Quartz | Level 8

Reeza;

OK bit by bit I am figuring this out-

In short the reference line must be in exactly the same format as the underlying data-

So if the dates are in format monyy5. in the dataset but I add a referent line as such as x= '01AUG13'D it fails to work properly-

So the question is how do I list the date

X=AUG13? in the same format

I have temporarily solved the problem by using the SAS dates (eg 19571 for AUG 1 2013)

and then using the dynamic function to make sure I list all the dates in the sgrender statement

but specifying the option to using monyy5 in the xaxisopts=(linearopts=( tickvalueformat=monyy5.))

Hopefully by being able to put the date format the right way it will solve another step of creating a macro variable for the purposes of listing all the dates but a viable option if necessary.

Lawrence

Reeza
Super User

Repost this in the graphics forum, one of the SAS guys will be able to help. 

Make sure to say what version of SAS you're using.

LB
Quartz | Level 8 LB
Quartz | Level 8

Reeza;

I just moved the whole thread over.

Many thanks.

Lawrence

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