BASIC PROGRAMMING FOR DATA ANALYSIS - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

BASIC PROGRAMMING FOR DATA ANALYSIS

Description:

Definition, Types of Programming languages, Characteristics of good algorithm, ... BASIC means ' Beginner's All Purpose Symbolic Instructions Code. ... – PowerPoint PPT presentation

Number of Views:15
Avg rating:3.0/5.0
Slides: 22
Provided by: drddut
Category:

less

Transcript and Presenter's Notes

Title: BASIC PROGRAMMING FOR DATA ANALYSIS


1
BASIC PROGRAMMING FOR DATA ANALYSIS
  • Dr. D. Dutta Roy
  • Psychology Research Unit
  • Indian Statistical Institute
  • 203, B.T. Road
  • Kolkata- 700108

2
CONTENTS
  • Introduction
  • Definition, Types of Programming languages,
    Characteristics of good algorithm, Flowchart,
    Programming structure , Data analysis
  • Data entry File handling, reading and printing
    data, Array, Operators, Commands, Data entry,
    Statements, Adv.functions
  • Data computation Max score,
  • result reporting

3
What is BASIC ?
  • BASIC is an useful programming languages for data
    entry, data analysis and reporting the result. In
    programming, there are three languages Machine
    level/low level (High state and low state or 1
    and 0) and higher level languages. BASIC is a
    higher level language. BASIC means Beginners
    All Purpose Symbolic Instructions Code. Computer
    does not understand the higher level language so
    higher level language is converted to machine
    language. Between these two languages, assembly
    level language exists. It involves a set mnemonic
    codes. BASIC is simple and easy-to-learn
    language, particularly suitable for the
    non-specialist users.

4
What is Programming ?
  • Programming is a set of commands or statements
    given to the computer in some computer language.
    These commands will be executed by the computer
    in a particular sequence. The list of commands
    given to the computer for solving a problem is
    called computer program.Any program written in
    high level language has to be translated into
    machine language before it is executed by the
    computer. This can be achieved with the help of
    translator programs - compilers (translating
    entire program and executing the program)and
    interpreters (translating each step and executing
    it). BASIC programs are normally interpreted not
    compiled.

5
Algorithms
  • Algorithm is a step-by-step procedure for solving
    a given problem. The characteristics of good
    algorithm are
  • They are simple but offer powerful and general
    solutions
  • They are well documented to be used and easily
    understood by others
  • They can be modified easily
  • They give correct solutions
  • They save computer time and memory space.
  • They can be used as sub-procedures for other
    problems.

6
Flow chart
  • Flow charting is a diagrammatic representation of
    the problem solving process, in which decision
    steps are laid out in logical order.

7
Operators
8
Programming Structure
  • Array creation
  • Opening the input,output,append file
  • Input/read data
  • Analysis of data as per programming flow
  • Displaying the output through file or through
    display unit as per user requirement
  • End

9
ARRAY
  • Array is used to store a large amount of data
    temporarily to
  • different variables. There are two types of
    array One
  • dimensional array and two dimensional array.
  • Syntax of one dimensional array
  • Dim ltarraynamegt (max.data number)
  • Dim Data (10)
  • Syntax of Two dimensional array
  • Dim ltarraynamegt (max.row, max.col.)
  • Dim Data (10,5)

10
Opening and Closing FilesInput and Output
statement
11
BASIC STATEMENT COMMANDS
12
TRANSFER STATEMENT
  • GOTO ltLINE NO.gt
  • GOSUB ltLINE NO.gt
  • .
  • .
  • .
  • RETURN

13
Conditional statement(IF-THEN)
  • IF-THEN-ELSE
  • IF condition 1 THEN
  • statement block 1
  • ELSE IF condition 2 THEN
  • statement block 2
  • ELSE
  • statement block n
  • ENDIF

14
Conditional statement(ON GOTO)
  • ON EXPRESSION GOTO LINE LIST.
  • ON EXPRESSION GOSUB LINE LIST.

15
Co
Conditional statement(SELECT)
  • Select case ltvariable namegt
  • case is gt 1
  • statement block1
  • case 2 to 4
  • statement block2
  • case 1
  • statement block 3
  • end select

16
Flow of BASIC program
  • There are three types of flow in writing the
    program
  • Sequential flow(working instructions
    sequentially)
  • Repetitive flow(doing same job repeatedly)
  • Conditional repetitive flow(Flow depends upon
    satisfaction of condition)

17
Data analysis
  • There are three phases of data analysis
  • Data entry data coding and feeding to computer,
    data tabulation and verification
  • Data analysis selection of useful measurement
    techniques and writing program
  • Display of results Displaying the data following
    users specification

18
DATA ENTRY AND CODING
  • CLS
  • REM This program is for entering the data and
    coding the variables
  • OPEN "c\windows\desktop\test.dat" FOR APPEND AS
    1
  • LOC1 1
  • LOC2 2
  • 10 INPUT "NAME OF STUDENTS
    ", NAME
  • IF NAME "0" THEN GOTO 100
  • INPUT "AGE
    ", AGE
  • INPUT "LOCALITY (TYPE U FOR URBAN AND R FOR
    RURAL) ", LOC
  • INPUT "MATHEMATICS EXAM. SCORE
    ", MATH
  • IF LOC "U" THEN WRITE 1, NAME, AGE, LOC1,
    MATH
  • IF LOC "R" THEN WRITE 1, NAME, AGE, LOC2,
    MATH
  • GOTO 10
  • 100 END

19
Advance Functions
20
Matrix Manipulation
  • A matrix is a rectangular array of numbers. In
    matrix algebra, the array is considered to be a
    single unit rather than collection of individual
    entries, and is operated upon as a unit. For
    calculation of two matrices, there should be the
    same number of rows and columns.
  • A 105 63 5
  • 218 80 2
  • 220 76 1
  • 84 102 4
  • B 240 121 1
  • 302 28 0

21
Addition of two matrices
  • REM program to add matrices of two sets of data
  • DIM a(3, 3), b(3, 3), c(3, 3)
  • n 3 m 3
  • FOR i 1 TO n
  • FOR j 1 TO m
  • READ a(i, j)
  • DATA 105,63,5,218,80,2,220,76,1
  • PRINT a(i, j)
  • NEXT j
  • NEXT i
  • PRINT ""
  • FOR k 1 TO n
  • FOR l 1 TO m
  • READ b(k, l)
  • DATA 84,102,4,240,121,1,302,28,0
  • PRINT b(k, l)
  • NEXT l
  • NEXT k
  • FOR mr 1 TO n
  • FOR mc 1 TO m
  • c(mr, mc) a(mr, mc) b(mr, mc)
  • NEXT mc
  • NEXT mr
  • PRINT
  • FOR g 1 TO n
  • FOR h 1 TO m
  • PRINT c(g, h)
  • NEXT h
  • NEXT g
Write a Comment
User Comments (0)
About PowerShow.com