BookmarkSubscribeRSS Feed
ManitobaMoose
Quartz | Level 8

Hi,

 

I am familiar with the asterisk being used in arrays when the number of arrays is not known. This is shown in the top part of the code below. However, it appears the asterisk can also be used with assignment statements, as below, in the Qtr1 assignment statement. Can someone describe how SAS uses the asteriski in the Qtr1 = Sum(of Month{*}) statement, and how sas knows how to distinguish this from the use as determining the correct number of arrays? Thanks.

 

 

Data TestPrep.SalesArray4 ; 
	Set TestPrep.Sales ;
	Array Month{*} JanSales FebSales  MarchAmt ; 
	Qtr1 = Sum(of Month{*}) ; 
run ; 

 

2 REPLIES 2
Tom
Super User Tom
Super User

The OF keyword allows you to use a variable list in a function call.  ARRAY_NAME(*) is an example of a variable list.

Other examples are things like

var1-var20
first -- last
prefix:
_all_
_numeric_
_character_
first-character-last
first-numeric-last

 

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!

How to Concatenate Values

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.

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