Hi all SAS Users,
After playing around for a while, only today, after reading suggestion from @Reeza , I just had a look on PROC EXPAND, which is very efficient and simple to generate the lead and lag variables rather than create the lag or lead variables manually and set condition missing for the first or last observation.
I am so surprising why I did not see much people using it (even in some published code in finance. When trying to find the answer, I think: people may prefer the traditional code
lagx=ifn(first.id,.,lag(x)); /*ifc for character value*/
because this code can be put in one datastep and make the code shorter (one can deal with many things other than creating a lag variable in one datastep).
Is it a reasonable thought?
Warmest regards.
You may want to peruse the entire SAS product catalog. Depending on what your organization does there can be a number of products that make things much nicer.
Once upon a time, in the days of SAS 6.12 I worked with a large government organization that had a license for almost all of the SAS products at the time. Installation disks ran to about 2-and-a-half stack feet. Found some of the ETS procedures very handy for dealing with part of our time series data, IML for a small number of simulation projects, AF and FSP for interface design to data extraction and custom output file creation and writing programs to keep up with the instrument changes at over 60 collection sites, used Proc Loan (ETS) to help analyze options for buying my house, SAS/QC to help with determining if we were having quality issues with collection instrument data, and other stuff.
If you have many of these modules it can be surprising just how much of the core of many tasks are available but you need to become familiar enough with the documentation to know where to look and recognize what you need.
Yes, there is a significant $$$ factor. The man hours trying to recreate some of the processes in the various modules with Base SAS and/or macro programming can add up fast and translates into even more money in some cases.
You may want to peruse the entire SAS product catalog. Depending on what your organization does there can be a number of products that make things much nicer.
Once upon a time, in the days of SAS 6.12 I worked with a large government organization that had a license for almost all of the SAS products at the time. Installation disks ran to about 2-and-a-half stack feet. Found some of the ETS procedures very handy for dealing with part of our time series data, IML for a small number of simulation projects, AF and FSP for interface design to data extraction and custom output file creation and writing programs to keep up with the instrument changes at over 60 collection sites, used Proc Loan (ETS) to help analyze options for buying my house, SAS/QC to help with determining if we were having quality issues with collection instrument data, and other stuff.
If you have many of these modules it can be surprising just how much of the core of many tasks are available but you need to become familiar enough with the documentation to know where to look and recognize what you need.
Yes, there is a significant $$$ factor. The man hours trying to recreate some of the processes in the various modules with Base SAS and/or macro programming can add up fast and translates into even more money in some cases.
> The man hours trying to recreate some of the processes in the various modules with Base SAS and/or macro programming can add up fast and translates into even more money in some cases.
This does not show on the balance sheet, so bean counters can "save" money' by not licencing products, and then congratulate themselves about all the savings they made.
I agree that PROC EXPAND can often be more straightforward in generating univariate (even multiple univariate) time series - and it can make it easier to generate leads.
But there are some characteristics of PROC EXPAND that can make it weaker than the data step alternative:
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: