BookmarkSubscribeRSS Feed
jerry898969
Pyrite | Level 9
I need to create a data set from scratch.

I need to create some year columns that goes from 1999-2003 then skips a year till 2007.


My data set should look like this
y1999 y2000 y 2001 y2002 y2003 y2005 y2007

Is this possible?

I'm not sure if this is the correct path to take but I have a table that has a variable that has all the years for a product. Some products have some of the years and some have all. I'm trying to find the best way to display that data in a matrix.

Thank you for your help
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Look at PROC TRANSPOSE to convert a "vertical" observation oriented SAS file to a "horizontal" column oriented SAS file.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

proc transpose site:sas.com
Peter_C
Rhodochrosite | Level 12
creating the columns needs no loop, just a simple statement like:[pre] length y1999 -y2003 y2005 y2007 ;[/pre]defines the columns but does not dynamically construct or fill the columns based on the data. For that, use Scott's method - proc transpose

good luck
peterC
jerry898969
Pyrite | Level 9
Thank you both so much for all your help.

The length statement did what I wanted. Thanks

The proc tranpose actually corrected a different issue I was having.


Thanks again for the quick and awesome help.
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1599 views
  • 0 likes
  • 3 in conversation