BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
aweaver
Fluorite | Level 6

Is it possible to use a first.variable statement and an infile?  I am tryin to sum up the album cost for each genre without using two data steps, currently the log says genre is unintialized.  Please help.

 


sas code.jpg
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

First. and last. are only available with a by statement. Variables in the by statement must be in the input dataset.

So the answer to your question is no.

Read the raw data into a dataset, then you can use by processing.

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

To use a first.Variable statement you have to have a by statement in your code?

Kurt_Bremser
Super User

First. and last. are only available with a by statement. Variables in the by statement must be in the input dataset.

So the answer to your question is no.

Read the raw data into a dataset, then you can use by processing.

ballardw
Super User

Depending on what you actually want for your final output one of the report procedures such as Proc Report or Tabulate might be more in line. These both support creating group totals based and often do not require a separate sort step.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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