BookmarkSubscribeRSS Feed
tobyfarms
Fluorite | Level 6

 I renamed  my columns from 01-12 to Jan-Dec but the PROC PRINT results does not align the results with the fields. 

[Note] the Results table list the months as 1-12 and not _01, _02, etc.  -But there are listed as numeric variables.

 

 

DATA RESULTS;

SET RESULTS;

JAN = _01;

FEB = _02;

MAR = _03;

APR = _04;

MAY = _05;

JUN = _06;

JUL = _07;

AUG = _08;

SEP = _09;

OCT = _10;

NOV = _11;

DEC = _12;

 

DATA LOADFAC DIVRSFAC;

SET RESULTS;

IF STATISTIC = 'LF' THEN OUTPUT LOADFAC; ELSE

IF STATISTIC = 'DF' THEN OUTPUT DIVRSFAC;

 

PROC PRINT DOUBLE DATA=DIVRSFAC;

VAR COSSNAME STATISTIC JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC;

FORMAT JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC ;

TITLE '2016 MONTHLY CLASS ';

TITLE2 'BASED ON SALES ';

 

PROC PRINT DOUBLE DATA=LOADFAC;

VAR COSSNAME STATISTIC JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC;

FORMAT JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC ;

TITLE '2016 MARYLAND MONTHLY ';

TITLE2 'BASED ON SALES';

run;

 

 

results.jpg

2 REPLIES 2
art297
Opal | Level 21

Your code didn't rename variables but, rather, has improper code to establish new values for the variables JAN, FEB, etc.

 

I would have to guess that you log showed that the code didn't run or replace the file. Additionally, it doesn't look like you could have obtained the results you posted, since the file wasn't limited to either LF or DF. The only way it could list the numbers shown as variable names is if those were labels that were assigned to JAN, FEB, etc.

 

Art, CEO, AnalystFinder.com

PaigeMiller
Diamond | Level 26

Unless I'm doing something wrong, your results are too small for me to read or even see, so maybe I'm not clear on the actual problem you see.

 

In your first data step, you are NOT renaming the columns. You are assigning numbers to the variables JAN, FEB, etc.

 

--
Paige Miller

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 843 views
  • 1 like
  • 3 in conversation