BookmarkSubscribeRSS Feed
jaycss
Fluorite | Level 6

 

I m new to SAS.   I am using SAS University Studio. I want to use INTCK and INTNX unction for given Dataset. 

I have imported following data-set  datetime in MYLIB library.

 

proc import datafile ="/folders/myfolders/testdata/datetime.xlsx"
out=mylib.datetime dbms=xlsx replace;
getnames=yes;
run;

 There is dataset on which i want to perform INTCK function.

DateTime.PNG

 

 

 

 

Thank you.

 

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You have not supplied any information for us to be able to help you.  Post your test data in the form of a datastep using the code window [ its the {i} above post are and following this post if needed:

https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

 

Then show from this test data what you want to see out, and what the logic is.  Just saying I want to use XYZ function doesn't tell us anything, how do you want to use it, to get what?

Also note posting pictures of data does not help, we need to see the structure of the data to determine things, is that actually a SAS numeric datetime variable for instance?  Intck/nx need nuermic SAS datetime variables to work with.

ballardw
Super User

Basically you now need to use a data step program such as:

 

data want;

    set have;

    newvar = intck('interval',variable1,variable2); /* since you only have 1 datetime variable this is likely not what you want*/

    othernewvar = intnx('interval', variable, incrementnumber);

run;

 

You can look up the syntax for INTX see what values are valid for interval. There are many options so do not expect a complete listing here. If you have a datetime variable and want to increment by day, week, month preface the interval with DT such as 'dtday' 'dtmonth'

 

More specific questions will yield better targeted responses.

LinusH
Tourmaline | Level 20
My recommendation is to start with the free SAS Programming 1 training, which will give you a foundation for SAS usage.
Right now learning SAS with fragments IMO pretty awkward and inefficient.
By the way, welcome to the wonderful and sometimes challenging world of SAS!
Data never sleeps

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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