MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Create report using SAS

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
sub
Beginner


Joined: 30 Jan 2007
Posts: 20
Topics: 12

PostPosted: Wed Jun 08, 2011 7:51 pm    Post subject: Create report using SAS Reply with quote

Hi,
Can someone please help me with a solution for creating a report from the below input file using SAS. My input file looks like this
Code:

STATE: New YORK
CITY : BUFFALO
DATE : 2011-01-01

STATE: NEW YORK
CITY : ALBANY
DATE : 2011-02-01

STATE: CALIFORNIA
CITY : MONTCLAIR
DATE : 2011-02-01
.
.
.

I need the output to be generated as given below
Code:

STATE          CITY           DATE
New YORK       BUFFALO        2011-01-01
NEW YORK       ALBANY         2011-02-01
CALIFORNIA     MONTCLAIR      2011-02-01
.
.
.

Can it be done using SAS?
Back to top
View user's profile Send private message
chandra
Beginner


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Thu Jun 09, 2011 2:49 am    Post subject: Reply with quote

Hi Sub,

You can do it is SAS as follows.

Code:

//OUTDD DD SYSOUT=*                   
//INDD  DD *                         
New YORK                             
BUFFALO                               
2011-01-01                           
NEW YORK                             
ALBANY                               
2011-02-01                           
CALIFORNIA                           
MONTCLAIR                             
2011-02-01                           
//SYSIN DD *                         
DATA state;                           
  INFILE INDD;                       
    INPUT #1 state   $20.             
          #2 city    $20.             
          #3 entdate $10.             
          ;                           
RUN;                                 
PROC PRINT DATA=state;               
RUN;                                 

_________________
Regards,
Chandra
Back to top
View user's profile Send private message
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Thu Jun 09, 2011 5:44 am    Post subject: Reply with quote

chandra, did you test that before posting ?
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
chandra
Beginner


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Thu Jun 09, 2011 7:58 am    Post subject: Reply with quote

Yes Expat,

I am getting following results

Code:
 OBS      state       city          entdate           
                                                           
       1     New YORK      BUFFALO      2011-01-01         
       2     NEW YORK      ALBANY       2011-02-01         
       3     CALIFORNIA    MONTCLAIR    2011-02-01

_________________
Regards,
Chandra
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Thu Jun 09, 2011 11:16 am    Post subject: Reply with quote

Unfortunately, those are not the requested results. . . Confused

di
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Thu Jun 09, 2011 11:42 am    Post subject: Reply with quote

papadi wrote:
Unfortunately, those are not the requested results. . . Confused


I agree chandra's input and output are differently formatted then OP's post. But unless we are trying to spoon feed, the required logic of row pointers is there.
_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Thu Jun 09, 2011 3:28 pm    Post subject: Reply with quote

If something is delivered that does not match the request, mentioning that this was intentional might be helpful. . .

Something like "While the output is not exactly as requested, the posted code does show how to use pointers to get to the data you want".
_________________
All the best,

di
Back to top
View user's profile Send private message
taltyman
JCL Forum Moderator
JCL Forum Moderator


Joined: 02 Dec 2002
Posts: 310
Topics: 8
Location: Texas

PostPosted: Thu Jun 09, 2011 4:33 pm    Post subject: Reply with quote

What... you guys aren't going to complain that chandra also keyed in the input wrong and did not capitalize every letter in New YORK?

The actual answer to the OP's question is

Yes



bonk
Back to top
View user's profile Send private message
sub
Beginner


Joined: 30 Jan 2007
Posts: 20
Topics: 12

PostPosted: Thu Jun 09, 2011 8:23 pm    Post subject: Reply with quote

Thanks Chandra. It works for me now.
Back to top
View user's profile Send private message
chandra
Beginner


Joined: 26 Sep 2003
Posts: 130
Topics: 36

PostPosted: Fri Jun 10, 2011 12:37 am    Post subject: Reply with quote

Hi Papadi,

I assumed that the OP has mentioned State, City and date in the input data to understand the data not as a part of data.

If you look at my original post I have removed Statem City and date headings from my input data.
_________________
Regards,
Chandra
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group