BookmarkSubscribeRSS Feed
buzzra
Calcite | Level 5

Hello,

 

I have just started using SAS Dataflux for Data analysis, so I am not too familiar with work arounds in SAS.

 

I have created a profile of a table with just two fields. One field consists of unique code for products and another field consists of date these products were created on. I want to count products for each month of each year and present it in a graph. I have managed to create a graph for numbers of products for each year but having trouble to do it for each month of each year.

bar chart.jpg

 

Below is how a table looks like where field ERSDA is for date

table.jpg

I wrote a custom metric as below

public integer articleCount2013
public integer articleCount2014
public integer articleCount2015
public integer articleCount2016
public integer articleCount2017
articleCount2013 = 0
articleCount2014 = 0
articleCount2015 = 0
articleCount2016 = 0
articleCount2017 = 0
	
	if left(`ERSDA`,4)=="2013"
	begin
		articleCount2013 = articleCount2013 + 1
	end
		
	else if left(`ERSDA`,4)=="2014"
		begin
		articleCount2014 = articleCount2014 + 1
	end		
	else if left(`ERSDA`,4)=="2015"
		begin
		articleCount2015 = articleCount2015 + 1
	end	
	else if left(`ERSDA`,4)=="2016"
		begin
		articleCount2016 = articleCount2016 + 1
	end	
	else if left(`ERSDA`,4)=="2017"
		begin
		articleCount2017 = articleCount2017 + 1
	end	

 

Could anyone please assist in doing this a better way and creating a graph with numbers of products for each month of each year ? And, I am using DatafluxData Management Studio Version : 2.4.0.22

 

Thanks in advance for you help.

Cheers

1 REPLY 1
Reeza
Super User

Dataflux is used for data management, less so visualization, usually that would be Base SAS. 

I've moved this thread to the Data Management forum, where Dataflux users are more likely to see it. 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 901 views
  • 0 likes
  • 2 in conversation