BookmarkSubscribeRSS Feed
rwasara
Calcite | Level 5

So I have a data set that will end up being huge when all said and done...however I am trying to figure out how to easily create a type of "waterfall effect" with this data table. 

I have a list of accts and have already calculated the number of months between to dates, number will be anywhere between 0 and 124 and this number identifies how many times this record (row of data) needs to be repeated in the data table.  previously before we had this many months of data we just created a query for each origination month and was able to append those queries in the end...etc.  But I am trying to do this a more effecient and easilyrepeatable way......any help or suggestions on how to accomplish this would be great!!

3 REPLIES 3
kiranv_
Rhodochrosite | Level 12

Please provide a small sample of data you have and output you want. So that someone will able to easily intrepret, what you are trying to say

rwasara
Calcite | Level 5

The data is confidential and I cannot post actual data here but I can try and give you an example......SEE ATTACHED

ballardw
Super User

Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.

 

Any example data that duplicates the behavior is fine.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

 

Spreadsheets have "cells". SAS data sets have variables and observations. A "cell" becomes the value of a variable for a given observation (row).

 

A generic approach looks like this:

 

data want;

   set have;

   if variable >0 then do i =1 to round(variable,1);

      output;

   end;

   drop i;

run;

 

The if is because you would need to ensure an actual value and positive. The round is because we don't know if you have fraction values. If your variable has a value of 2.1 how many duplicate rows do you want for the 0.1 portion.

 

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
  • 10358 views
  • 4 likes
  • 3 in conversation