Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

DATE

Reply
Regular Contributor
Posts: 197

DATE

Hi! All,

I want to calculate how many days remaining in this month, for example i have date field with last updated date (20th Jan, 2014), i want to find out remaining days in this month (Jan). is there any way to do this.




Thanks,

Teja Surapaneni.

Super Contributor
Posts: 578

Re: DATE

days=intnx('month',datecol,0,'end')-datecol;

Super Contributor
Posts: 308

Re: DATE

Hello,

data _null_;

have=today();
want=intck('day',have,intnx('month',have,0,'e'));
put want=;

run;

Occasional Contributor
Posts: 8

Re: DATE

Hi,

Dates in SAS are stored as numbers.

For your problem, you can create a new column defined as "'31JAN2015'd - datevariable" which gives you the days remaining in this month, provided datevariable is in numerical or date format.

Frequent Contributor
Posts: 77

Re: DATE

Please as dates are saved like numbers how do you show  them in the table list or graphics lines?

Because I can´t assign the format in other place

thnaks

Regular Contributor
Posts: 173

Re: DATE

Hi Silin,

dates are represented in a date format but at the end they are just a number.

So you can decide for yourselves if you want a date format or transform the date to a number

and use a numeric format. (Using a new calculated field)

question is, what is your goal to reach using the available tools.

hope this helps a little.

greetings

Trusted Advisor
Posts: 1,296

Re: DATE

Hi Teja,

It may be best to do the processing prior to loading the data into SAS Visual Analytics if you want to use the intnx function. As you can see in the screenshot this function is not available within the Calculated Data Item expression builder

format.png

As suggests you could convert the data item to its number and do a numeric calculation. Note if you import the data from Excel it uses the Excel format type to determine its metadata type in SAS Visual Analytics.

Alternatively, you could use SAS Visual Analytics Data Builder to create a query to create an expression for your new Days column as the intnx function is available there as per the screenshot below

format.png

Kind Regards,

Michelle

Regular Contributor
Posts: 197

Re: DATE

Hi All, Thanks for your valuable suggestions,

Hi Michelle, Present don't have permission to access data query builder, i have permission to access only Reports, is there any way to this in reports (Version 6.4). Every Month  i am creating manually new date variable 'Month end' (31st Jan 2015), and then i will convert the two date variables'MAX DATE' (20th JAN 2015), 'MONTH END'(31st JAN 2015) into numeric using treatas function, after that i will subtract the two numeric dates then i can easily get answer changing Aggregation to MAX in Properties Tab. but my problem is every month it will be automated, is there any way to do this in reports environment. 

Thanks,

Teja Surapaneni.

Trusted Advisor
Posts: 1,296

Re: DATE

Hi Teja,

I would want to automate the process too... Having access to the SAS Visual Analytics Data Builder will enable you to have a scheduled query that creates these columns and update your table. Alternatively, you could have a scheduled SAS process outside of the SAS Visual Analytics environment prior to the data load process.

Kind Regards,

Michelle

Ask a Question
Discussion stats
  • 8 replies
  • 833 views
  • 4 likes
  • 7 in conversation