CSUN Programming Worksheet

Description

Using the two course datasets (stops and officer) or a dataset of your own choosing (preapproval by instructor required), create your own script that cleans and processes these data. Datasets will be sent via email as they are too large to post in Canvas. Please turn in your Stata .do file (or R equivalent) by Week 4 on or before class at 9AM Feb 11th. I will run your .do file on the raw data and you will be evaluated based on the final dataset that it creates as well as your use of the commands discussed in class and organization of your code.

3 attachmentsSlide 1 of 3attachment_1attachment_1attachment_2attachment_2attachment_3attachment_3

Unformatted Attachment Preview

Programming Assignment 1
Using the two course datasets (stops and officer) or a dataset of your own choosing
(preapproval by instructor required), create your own script that cleans and processes
these data. Datasets will be sent via email as they are too large to post in Canvas.
Please turn in your Stata .do file (or R equivalent) by Week 4 on or before class at 9AM Feb
11th. I will run your .do file on the raw data and you will be evaluated based on the final
dataset that it creates as well as your use of the commands discussed in class and
organization of your code.
Sample data is located on DropBox, see announcement for the link. Email me if you have
problems accessing it.
The script must contain the following elements:









Best practice in cleaning: tabbing, logs, date stamps, org structure etc.
Create/use at least one temp file
Create/use at least one macro
Create/use at least one loop
Define at least one program
Execute at least one of the different joins discussed in class
Ensure all variables/values are labeled and stored in the least resource
intensive format possible
All date and time variables should be converted to date/time formats
Clean/standardize all data/variables
Matthew B. Ross, Ph.D.
Econometrics 1
Lecture 1: Intro & Stata Basics
Matthew B. Ross, Ph.D.
Economic Sciences Department
School of Social Science, Policy, & Evaluation
Claremont Graduate University
Economic Sciences
Econometrics
Department
1
School of Social Science,January
Policy, 21,
& Evaluation
2022
1Clarem
/ 32
Game Plan for Today
Welcome/Intros
Review Syllabus
Review Expectations/Assignments
Today’s Lesson: Intro to Stata
Assignment 1 in more detail
Matthew B. Ross, Ph.D.
Economic Sciences
Econometrics
Department
1
School of Social Science,January
Policy, 21,
& Evaluation
2022
1Clarem
/ 32
Overview of Stata
Why Stata?
REALLY fast w/ matrices
Holds data in virtual memory (advantage and disadvantage)
Designed for social scientists (the standard)
Peer-reviewed journal for user-written packages
Latest/greatest package development
Matthew B. Ross, Ph.D.
Economic Sciences
Econometrics
Department
1
School of Social Science,January
Policy, 21,
& Evaluation
2022
2Clarem
/ 32
Key Features of Stata
GUI vs. Compiler (command line)
Local vs. server (various editions)
Key file types
scripts: .do
data: .dta
logs .smcl
graphs .gph
Can read/write and import/export many other file types
Help command is amazing
User-written programs and .ado files (load permanently or in a
session)
Again, really FAST (1 dataset, no dataframes)
Matthew B. Ross, Ph.D.
Economic Sciences
Econometrics
Department
1
School of Social Science,January
Policy, 21,
& Evaluation
2022
3Clarem
/ 32
Key Features of Stata
GUI vs. Compiler (command line)
Local vs. server (various editions)
Key file types
scripts: .do
data: .dta
logs .smcl
graphs .gph
Can read/write and import/export many other file types
Help command is amazing
User-written programs and .ado files (load permanently or in a
session)
Matthew B. Ross, Ph.D.
Economic Sciences
Econometrics
Department
1
School of Social Science,January
Policy, 21,
& Evaluation
2022
4Clarem
/ 32
Matthew B. Ross, Ph.D.
Let’s briefly walk through Stata!
Economic Sciences
Econometrics
Department
1
School of Social Science,January
Policy, 21,
& Evaluation
2022
5Clarem
/ 32
Syntax
New version text wrap, older versions do not, can use delimiters
Stata syntax is inconsistent and clunky- it is what it is.
Case sensitive, wildcards, arithmetic
General Syntax Structure
1
2
[ p r e f i x ] command [ v a r l i s t ] [= e x p r e s s i o n ] [ i f / i n ]
[ weight ] [ using f i l e ] [ , options ]
3
4
∗Comments l o o k l i k e
this . . . ∗
5
6
7
/∗And t h e y a l s o t h e y Look
L i k e t h i s ∗/
Matthew B. Ross, Ph.D.
Economic Sciences
Econometrics
Department
1
School of Social Science,January
Policy, 21,
& Evaluation
2022
6Clarem
/ 32
Syntax Examples
Loading Flat Files
1
2
3
i m p o r t d e l i m i t e d ” TXDPS_2015_Stops . csv ” , c l e a r
s t r i n g c o l s ( a l l ) d e l i m i t e r ( ” ,” ) v a r n a m e s ( 1 )
∗ L o a d i n g a CSV∗
4
5
6
7
i m p o r t e x c e l ” TX_TCOLE_Proficiency – Active . xlsx ” ,
s h e e t ( ” Sheet1 ” ) f i r s t r o w a l l s t r i n g c l e a r
∗ L o a d i n g an E x c e l f i l e ∗
8
9
10
u s e ” analytical_sample ” i f n

Purchase answer to see full
attachment

Explanation & Answer:
1 Database

Tags:
officer

datasets

stops

User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.

Looking for this assignment?

do my essay homework

Reviews, comments, and love from our customers and community

Article Writing

Great service so far. Keep doing what you do, I am really impressed by the work done.

Alexender

Researcher

PowerPoint Presentation

I am speechless…WoW! Thank you so much! Definitely, the writer is talented person. She provided me with an essay a day early before the due date!

Stacy V.

Part-time student

Dissertation & Thesis

This was a very well-written paper. Great work fast. I was in pretty desperate need for help to finish this paper before the due date, which was in nine hours.

M.H.H. Tony

Student

Annotated Bibliography

I love working with this company. You always go above and beyond and exceed my expectations every time. Kate did a WONDERFUL job. I would highly recommend her.

Francisca N.

Student

Book Report / Review

I received my order wayyyyyyy sooner than I expected. Couldn’t ask for more. Very good at communicating & fast at replying. And change & corrections she put in the effort to go back and change it!

Mary J.

Student

Essay (Any Type)

On time, perfect paper. All concerns & matters I had Tom was able to answer them! I will definitely provide him with more orders!

Prof. Kate (Ph.D)

Student

Case Study

Awesome! Great papers, and early! Thank you so much once again! Definitely recommend to trust James with your assignments! He won’t disappoint!

Kaylin Green

Student

Proofreading & Editing

Thank you Dr. Rebecca for editing my essays! She completed my task literally in 3 hours. For sure will work with her again, she is great and follows all instructions

Rebecca L.

Researcher

Critical Thinking / Review

Extremely thorough summary, understanding and examples found for social science readings, with edits made as needed and on time. It’s like having a tutoring service available (:

Arnold W.

Customer

Coursework

Perfect!I only paid about $80, which i think was a good price considering what my paper entailed. My paper was done early and it was well written!

Joshua W.

Student

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>