Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language SPSS

Date:04/20/05
Author:Keith Chidsey
URL:n/a
Comments:0
Info:n/a
Score: (3.00 in 2 votes)
****************************************************************************
* File:			beer.sps
* Source Code:	SPSS 5.0
* System/OS:		HP/UNIX
* Written By:		Keith Chidsey (keithc@gsbc.com)
*
* Write out lyrics to "99 Bottles of Beer on the Wall" to file <beersong>.
****************************************************************************

FILE HANDLE    	DUMMY/NAME'BEER.SPS'/LRECL=80
FILE HANDLE    	BEERSONG/NAME'BEERSONG'/LRECL=80

DATA LIST 		FILE=DUMMY FIXED RECORDS=1/
				DUMMY(A1)

STRING			LYRIC1,LYRIC2,SPACE(A80)

LOOP			BOTTLES=99 TO 1 BY -1
COMPUTE		LYRIC1=CONCAT(STRING(BOTTLES,F2),
 				' BOTTLES OF BEER ON THE WALL, ',
				STRING(BOTTLES,F2),
				' BOTTLES OF BEER.')
COMPUTE		LYRIC2=CONCAT('TAKE ONE DOWN, PASS IT AROUND, ',
				STRING(BOTTLES-1,F2),
				' BOTTLES OF BEER ON THE WALL.')
WRITE			OUTFILE=BEERSONG RECORDS=3/
				LYRIC1/LYRIC2/SPACE
END LOOP
EXECUTE

FINISH

Download Source | Write Comment

Alternative Versions

Comments

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: